Ver Fonte

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

Marvin Löschenkohl há 7 meses atrás
pai
commit
19dcd8d0b6
1 ficheiros alterados com 8 adições e 6 exclusões
  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",