avrora.util
Class Arithmetic

java.lang.Object
  extended byavrora.util.Arithmetic

public class Arithmetic
extends java.lang.Object

The Arithmetic class implements a set of useful methods that are used by the simulator and assembler for converting java types to various data types used by the machine.


Constructor Summary
Arithmetic()
           
 
Method Summary
static int bitCount(byte value)
           
static byte clearBit(byte val, int bit)
           
static boolean getBit(byte val, int bit)
           
static boolean getBit(int val, int bit)
           
static int getBitRangeMask(int low, int high)
           
static int getInverseBitRangeMask(int low, int high)
           
static int getSingleBitMask(int bit)
           
static int getSingleInverseBitMask(int bit)
           
static byte high(int val)
           
static byte high(short val)
           
static byte low(int val)
           
static byte low(short val)
           
static int lowestBit(long value)
           
static byte reverseBits(byte value)
           
static byte setBit(byte val, int bit)
           
static byte setBit(byte val, int bit, boolean on)
           
static int setBit(int val, int bit, boolean on)
           
static char ubyte(byte b1)
           
static char uhigh(char val)
           
static char uhigh(short val)
           
static char ulow(char val)
           
static char ulow(short val)
           
static char uword(byte b1, byte b2)
           
static short word(byte b1, byte b2)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Arithmetic

public Arithmetic()
Method Detail

word

public static short word(byte b1,
                         byte b2)

uword

public static char uword(byte b1,
                         byte b2)

ubyte

public static char ubyte(byte b1)

low

public static byte low(short val)

high

public static byte high(short val)

low

public static byte low(int val)

high

public static byte high(int val)

ulow

public static char ulow(char val)

uhigh

public static char uhigh(char val)

ulow

public static char ulow(short val)

uhigh

public static char uhigh(short val)

getBit

public static boolean getBit(byte val,
                             int bit)

getBit

public static boolean getBit(int val,
                             int bit)

setBit

public static byte setBit(byte val,
                          int bit)

setBit

public static byte setBit(byte val,
                          int bit,
                          boolean on)

setBit

public static int setBit(int val,
                         int bit,
                         boolean on)

clearBit

public static byte clearBit(byte val,
                            int bit)

lowestBit

public static int lowestBit(long value)

reverseBits

public static byte reverseBits(byte value)

bitCount

public static int bitCount(byte value)

getSingleBitMask

public static int getSingleBitMask(int bit)

getSingleInverseBitMask

public static int getSingleInverseBitMask(int bit)

getBitRangeMask

public static int getBitRangeMask(int low,
                                  int high)

getInverseBitRangeMask

public static int getInverseBitRangeMask(int low,
                                         int high)