Class IntegerValue
java.lang.Object
svm.value.Value
svm.value.IntegerValue
IntegerValue.
integer_value ::= c-int integer_literal:string
character_value ::= c-char byte
size_value
::= c-size type
::= NOSIZE
attribute_address ::= c-aaddr attribute:tag
An integer literal is a string:
< <radix> R>? <sign>? <digit>+
where digit is one of the (ISO coded) decimal digits, and sign may be + or -. The letter R, if included,
signals that the integer is specified with a radix preceding R. The only legal radices are 2, 4, 8 and 16.
If the radix is 16, <digit> may also be one of the (ISO-coded) letters A-F, with the obvious meaning.
Note that an integer literal may not contain spaces.
Link to GitHub: Source File.
- Author:
- S-Port: Definition of S-code, Øystein Myhre Andersen
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionDefault ConstructorprivateIntegerValue(Type type, int value) Construct a new IntegerValue -
Method Summary
Modifier and TypeMethodDescriptionReturns the result of: this value + other valueReturns the result of: this value and other valuebooleanCompare this Value with the given Value according to the given relation.Returns the result of: this value / other valuevoidemit(DataSegment dseg) Add this value to the given DataSegmentstatic intintValue(IntegerValue val) Returns the int value of the given IntegerValueReturns the result of: this value * other valueneg()Returns the negative value of this Value object.static IntegerValueCreate a new IntegerValue with the given parametersstatic IntegerValueScans the remaining S-Code belonging to this character_value.static IntegerValueScans the remaining S-Code belonging to this integer_value.static IntegerValueScans the remaining S-Code belonging to this size_value.static IntegerValueScans the remaining S-Code belonging to this attribute_address.Returns the result of: this value or other valuestatic IntegerValueread(AttributeInputStream inpt) Reads a IntegerValue from the given input.Returns the result of: this value rem other valueReturns the result of: this value shiftInstr other value S_LSHIFTA: Signed Left Shift << The left shift operator moves all bits by a given number of bits to the left. S_LSHIFTL: Unsigned Left Shift << The left shift operator moves all bits by a given number of bits to the left. S_RSHIFTA: Signed Right Shift >> The right shift operator moves all bits by a given number of bits to the right.Returns the result of: this value - other valuedoubletoDouble()Returns the double value of this Value object.floattoFloat()Returns the float value of this Value object.toString()voidwrite(AttributeOutputStream oupt) Writes this Value to the given output.Returns the result of: this value xor other value
-
Field Details
-
value
public int valueThe int value
-
-
Constructor Details
-
IntegerValue
public IntegerValue()Default Constructor -
IntegerValue
Construct a new IntegerValue- Parameters:
type- the s-type: INT, CHAR, SIZE, AADDRvalue- the int value
-
-
Method Details
-
of
Create a new IntegerValue with the given parameters- Parameters:
type- the s-type: INT, CHAR, SIZE, AADDRvalue- the int value- Returns:
- an IntegerValue or null
-
ofScode_INT
Scans the remaining S-Code belonging to this integer_value. Then construct a new IntegerValue with type INT.- Returns:
- that IntegerValue instance.
-
ofScode_CHAR
Scans the remaining S-Code belonging to this character_value. Then construct a new IntegerValue with type CHAR.- Returns:
- that IntegerValue instance.
-
ofScode_SIZE
Scans the remaining S-Code belonging to this size_value. Then construct a new IntegerValue with type SIZE.- Returns:
- that IntegerValue instance.
-
ofScode_AADDR
Scans the remaining S-Code belonging to this attribute_address. Then construct a new IntegerValue with type AADDR.- Returns:
- that IntegerValue instance.
-
intValue
Returns the int value of the given IntegerValue- Parameters:
val- the IntegerValue- Returns:
- the int value of the given IntegerValue
-
emit
Description copied from class:ValueAdd this value to the given DataSegment -
toFloat
-
toDouble
-
neg
-
add
-
sub
-
mult
-
div
-
rem
-
and
-
or
-
xor
-
compare
Description copied from class:ValueCompare this Value with the given Value according to the given relation. -
shift
Description copied from class:ValueReturns the result of: this value shiftInstr other value S_LSHIFTA: Signed Left Shift << The left shift operator moves all bits by a given number of bits to the left. S_LSHIFTL: Unsigned Left Shift << The left shift operator moves all bits by a given number of bits to the left. S_RSHIFTA: Signed Right Shift >> The right shift operator moves all bits by a given number of bits to the right. S_RSHIFTL: Unsigned Right Shift >>> It is the same as the signed right shift, but the vacant leftmost position is filled with 0 instead of the sign bit. -
toString
-
write
Description copied from class:ValueWrites this Value to the given output.- Overrides:
writein classValue- Parameters:
oupt- the output stream- Throws:
IOException- if IOException occur
-
read
Reads a IntegerValue from the given input.- Parameters:
inpt- the AttributeInputStream- Returns:
- the IntegerValue read
- Throws:
IOException- if IOException occur
-