Constructor and Description |
---|
Word() |
Modifier and Type | Method and Description |
---|---|
Word |
and(Word w2)
Bit-wise and of two words.
|
boolean |
EQ(Word w2)
Equality comparison
|
static Word |
fromIntSignExtend(int val)
Converts an int to a word.
|
static Word |
fromIntZeroExtend(int val)
Converts an int to a word.
|
static Word |
fromLong(long val)
Converts a long to a word.
|
boolean |
GE(Word w2)
Greater-than or equal comparison
|
boolean |
GT(Word w2)
Greater-than comparison
|
boolean |
isMax()
Test for zero.
|
boolean |
isZero()
Test for zero.
|
boolean |
LE(Word w2)
Less-than or equal comparison
|
Word |
lsh(int amt)
Left-shift a word.
|
boolean |
LT(Word addr2)
Less-than comparison
|
static Word |
max()
The maximum representable Word value.
|
Word |
minus(Extent w2)
Subtract an extent from a word.
|
Word |
minus(Offset w2)
Subtract an offset from a word
|
Word |
minus(Word w2)
Subtract two words
|
boolean |
NE(Word w2)
Not-equal comparison
|
Word |
not()
Bit-wise complement of a word.
|
static Word |
one()
The Word constant 1.
|
Word |
or(Word w2)
Bit-wise or of two words.
|
Word |
plus(Extent w2)
Add an extent to a word
|
Word |
plus(Offset w2)
Add an offset to a word
|
Word |
plus(Word w2)
Adds two words.
|
Word |
rsha(int amt)
Arithmetic right-shift a word.
|
Word |
rshl(int amt)
Logical right-shift a word.
|
Address |
toAddress() |
Extent |
toExtent() |
int |
toInt()
Type-cast to an int, truncating on 64-bit platforms.
|
long |
toLong()
Type-cast to a long, zero-extending on a 32-bit platform.
|
Offset |
toOffset() |
Word |
xor(Word w2)
Bit-wise exclusive or of two words.
|
static Word |
zero()
The Word constant 0.
|
public Word()
public static Word fromIntSignExtend(int val)
val
- the value to convert to a wordpublic static Word fromIntZeroExtend(int val)
val
- the value to convert to a wordpublic static Word fromLong(long val)
val
- the value to convert to a wordpublic static Word zero()
Word.fromIntSignExtend(0)
, but more readable.public static Word one()
Word.fromIntSignExtend(1)
, but more readable.public static Word max()
public int toInt()
public long toLong()
public Word plus(Word w2)
w2
- the word to addpublic Word plus(Offset w2)
w2
- the offset to addpublic Word plus(Extent w2)
w2
- the extent to addpublic Word minus(Word w2)
w2
- the word to subtractpublic Word minus(Offset w2)
w2
- the offset to subtractpublic Word minus(Extent w2)
w2
- the extent to subtractpublic boolean isZero()
.EQ(Word.zero())
true
if this is equal to Word.zero()
,
false
otherwisepublic boolean isMax()
.EQ(Word.max())
true
if this is equal to Word.max()
,
false
otherwisepublic boolean LT(Word addr2)
addr2
- the address to compare withWord
instance is less than addr2
public boolean LE(Word w2)
w2
- the word to compare withWord
instance is less than or equal to w2
public boolean GT(Word w2)
w2
- the word to compare withWord
instance is greater than w2
public boolean GE(Word w2)
w2
- the word to compare withWord
instance is greater than or equal to w2
public boolean EQ(Word w2)
w2
- the word to compare withWord
instance is equal to w2
public boolean NE(Word w2)
w2
- the word to compare withWord
instance is not equal to w2
public Word and(Word w2)
w2
- the word to and withpublic Word or(Word w2)
w2
- the word to or withpublic Word xor(Word w2)
w2
- the word to xor withpublic Word lsh(int amt)
amt
- the amount to shift bypublic Word rshl(int amt)
lsh(int)
.amt
- the amount to shift bypublic Word rsha(int amt)
lsh(int)
.
Arithmetic right-shift a word. Equivalent to the integer >>
operatoramt
- the amount to shift by