Class SVM_REM
java.lang.Object
svm.instruction.SVM_Instruction
svm.instruction.SVM_REM
SVM-INSTRUCTION: REM
Runtime Stack
..., sos, tos →
..., result
The 'tos' and 'sos' are popped off the Runtime stack. The 'result' is calculated as result = sos rem tos. Then the 'result' is pushed onto the Runtime Stack.
'tos' and 'sos' must be of type int.
Remainder, defined as "sos - (sos // tos) * tos".
Note that SIMULA demands "truncation towards zero" for integer division. Thus (except for a zero remainder) the result of rem has the same sign as the result of the division. In more formal terms:
i div j = sign(i/j) * entier(abs(i/j))
i rem j = i - (i div j) * j
where '/' represents the exact mathematical division within the space of real numbers.
Link to GitHub: Source File.
- Author:
- S-Port: Definition of S-code, Øystein Myhre Andersen
-
Field Summary
Fields inherited from class SVM_Instruction
iADD, iADDREG, iAND, iASSIGN, iCALL, iCALLSYS, iCOMPARE, iCONVERT, iDECO, iDIST, iDIV, iDUP, iENTER, iEQV, iGETO, iGOTO, iIMP, iINCO, iINITO, iJUMP, iJUMPIF, iLINE, iLOAD, iLOADA, iMax, iMULT, iNEG, iNOOP, iNOT, iOR, iPOPK, iPRECALL, iPUSHC, iPUSHLEN, iPUSHR, iREM, iRESTORE, iRETURN, iSAVE, iSETO, iSHIFT, iSTORE, iSUB, iSWITCH, iXOR, opcode -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()Execute this SVM instructionstatic SVM_REMread(AttributeInputStream inpt) Reads an SVM_REM instruction from the given input.toString()voidwrite(AttributeOutputStream oupt) Write this SVM instruction to the given output.Methods inherited from class SVM_Instruction
edOpcode, readObject
-
Constructor Details
-
SVM_REM
public SVM_REM()Construct a new SVM_REM instruction
-
-
Method Details
-
execute
public void execute()Description copied from class:SVM_InstructionExecute this SVM instruction- Overrides:
executein classSVM_Instruction
-
toString
-
write
Description copied from class:SVM_InstructionWrite this SVM instruction to the given output.- Overrides:
writein classSVM_Instruction- Parameters:
oupt- the output stream- Throws:
IOException- if IOException occur
-
read
Reads an SVM_REM instruction from the given input.- Parameters:
inpt- the input stream- Returns:
- the SVM_REM instruction read
- Throws:
IOException- if IOException occur
-