Browse Source

replaced simple bit operations with functions, as the compiler does not support them

Marvin Löschenkohl 4 weeks ago
parent
commit
19dcd8d0b6
1 changed files with 8 additions and 6 deletions
  1. 8 6
      src/me/hammerle/snuviscript/code/FunctionRegistry.java

+ 8 - 6
src/me/hammerle/snuviscript/code/FunctionRegistry.java

@@ -169,12 +169,14 @@ public class FunctionRegistry {
             other.term();
             sc.getScriptManager().removeScript(other);
         });
-        registerFunction(">>", (sc, in) -> (double) (in[0].getInt(sc) >> in[1].getInt(sc)));
-        registerFunction("<<", (sc, in) -> (double) (in[0].getInt(sc) << in[1].getInt(sc)));
-        registerFunction("&", (sc, in) -> (double) (in[0].getInt(sc) & in[1].getInt(sc)));
-        registerFunction("|", (sc, in) -> (double) (in[0].getInt(sc) | in[1].getInt(sc)));
-        registerFunction("^", (sc, in) -> (double) (in[0].getInt(sc) ^ in[1].getInt(sc)));
-        registerFunction("~", (sc, in) -> (double) (~in[0].getInt(sc)));
+        registerFunction("bit.rightshift",
+                (sc, in) -> (double) (in[0].getInt(sc) >> in[1].getInt(sc)));
+        registerFunction("bit.leftshift",
+                (sc, in) -> (double) (in[0].getInt(sc) << in[1].getInt(sc)));
+        registerFunction("bit.and", (sc, in) -> (double) (in[0].getInt(sc) & in[1].getInt(sc)));
+        registerFunction("bit.or", (sc, in) -> (double) (in[0].getInt(sc) | in[1].getInt(sc)));
+        registerFunction("bit.xor", (sc, in) -> (double) (in[0].getInt(sc) ^ in[1].getInt(sc)));
+        registerFunction("bit.invert", (sc, in) -> (double) (~in[0].getInt(sc)));
         registerFunction("bit.set",
                 (sc, in) -> (double) (in[0].getInt(sc) | (1 << (in[1].getInt(sc)))));
         registerFunction("bit.unset",