mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-04-08 14:37:40 +00:00
Renamed modulus to modulo
This commit is contained in:
parent
55fa7be4d1
commit
469fd63320
@ -70,7 +70,7 @@ public class AsmFormat {
|
||||
* @return
|
||||
*/
|
||||
private static String getAsmConstantBinary(Program program, ConstantValue left, OperatorBinary operator, ConstantValue right, ScopeRef codeScope) {
|
||||
if(Operators.MODULUS.equals(operator)) {
|
||||
if(Operators.MODULO.equals(operator)) {
|
||||
// Remainder operator % not supported by KickAss - use modulo function instead
|
||||
return "mod("+
|
||||
getAsmConstant(program, left, operator.getPrecedence(), codeScope) +
|
||||
|
@ -6,10 +6,10 @@ import dk.camelot64.kickc.model.values.ConstantInteger;
|
||||
import dk.camelot64.kickc.model.values.ConstantLiteral;
|
||||
import dk.camelot64.kickc.model.values.ConstantPointer;
|
||||
|
||||
/** Numeric modulus operator ie. remainder after division ( x % y ) */
|
||||
public class OperatorModulus extends OperatorBinary {
|
||||
/** Numeric modulo operator ie. remainder after division ( x % y ) */
|
||||
public class OperatorModulo extends OperatorBinary {
|
||||
|
||||
public OperatorModulus(int precedence) {
|
||||
public OperatorModulo(int precedence) {
|
||||
super("%", "_mod_", precedence);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class Operators {
|
||||
public static final OperatorUnary CAST_BOOL= new OperatorCastBool(2);
|
||||
public static final OperatorBinary MULTIPLY = new OperatorMultiply(3);
|
||||
public static final OperatorBinary DIVIDE = new OperatorDivide(3);
|
||||
public static final OperatorBinary MODULUS = new OperatorModulus(3);
|
||||
public static final OperatorBinary MODULO = new OperatorModulo(3);
|
||||
public static final OperatorBinary PLUS = new OperatorPlus(4);
|
||||
public static final OperatorBinary MINUS = new OperatorMinus(4);
|
||||
public static final OperatorBinary SHIFT_LEFT = new OperatorShiftLeft(5);
|
||||
@ -60,7 +60,7 @@ public class Operators {
|
||||
case "/":
|
||||
return DIVIDE;
|
||||
case "%":
|
||||
return MODULUS;
|
||||
return MODULO;
|
||||
case "==":
|
||||
return EQ;
|
||||
case "!=":
|
||||
|
@ -8,7 +8,7 @@ import dk.camelot64.kickc.model.statements.Statement;
|
||||
import dk.camelot64.kickc.model.statements.StatementAssignment;
|
||||
|
||||
/**
|
||||
* Assert that no the code has no multiply/divide/modulus operators left.
|
||||
* Assert that no the code has no multiply/divide/modulo operators left.
|
||||
*/
|
||||
public class Pass3AssertNoMulDivMod extends Pass2SsaAssertion {
|
||||
|
||||
@ -28,8 +28,8 @@ public class Pass3AssertNoMulDivMod extends Pass2SsaAssertion {
|
||||
if(Operators.DIVIDE.equals(assignment.getOperator())) {
|
||||
throw new CompileError("ERROR! Runtime division not supported. "+statement.toString(getProgram(), false));
|
||||
}
|
||||
if(Operators.MODULUS.equals(assignment.getOperator())) {
|
||||
throw new CompileError("ERROR! Runtime modulus not supported. "+statement.toString(getProgram(), false));
|
||||
if(Operators.MODULO.equals(assignment.getOperator())) {
|
||||
throw new CompileError("ERROR! Runtime modulo not supported. "+statement.toString(getProgram(), false));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -800,8 +800,8 @@ public class TestPrograms {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoRemRuntime() throws IOException, URISyntaxException {
|
||||
assertError("no-rem-runtime", "Runtime modulus not supported");
|
||||
public void testNoModRuntime() throws IOException, URISyntaxException {
|
||||
assertError("no-mod-runtime", "Runtime modulo not supported");
|
||||
}
|
||||
|
||||
|
||||
|
@ -123,13 +123,13 @@ byte[] FORM_TEXT =
|
||||
" bmm 0 pattern p0 screen s0 @" +
|
||||
" mcm 0 start 00 gfx g0 @" +
|
||||
" ecm 0 step 00 colors c0 @" +
|
||||
" hicolor 0 modulus 00 @" +
|
||||
" hicolor 0 modulo 00 @" +
|
||||
" linear 0 COLORS @" +
|
||||
" color off 0 PLANE B palet 0 @" +
|
||||
" chunky 0 pattern p0 bgcol0 00 @" +
|
||||
" border off 0 start 00 bgcol1 00 @" +
|
||||
" overscan 0 step 00 bgcol2 00 @" +
|
||||
" modulus 00 bgcol3 00 @" +
|
||||
" modulo 00 bgcol3 00 @" +
|
||||
"@" ;
|
||||
byte[] FORM_COLS =
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@" +
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Test that remainder at runtime gives a proper error
|
||||
// Test that modulo at runtime gives a proper error
|
||||
|
||||
void main() {
|
||||
byte* screen = $400;
|
Loading…
x
Reference in New Issue
Block a user