True modulo and unsigned right shift. (#10885)

This commit is contained in:
Redstonneur1256
2025-06-02 20:05:45 +02:00
committed by GitHub
parent f924d0b533
commit ea333a0a63
2 changed files with 4 additions and 0 deletions

View File

@@ -2599,11 +2599,13 @@ lenum.always = Always true.
lenum.idiv = Integer division. lenum.idiv = Integer division.
lenum.div = Division.\nReturns [accent]null[] on divide-by-zero. lenum.div = Division.\nReturns [accent]null[] on divide-by-zero.
lenum.mod = Modulo. lenum.mod = Modulo.
lenum.emod = True modulo, result is always positive.
lenum.equal = Equal. Coerces types.\nNon-null objects compared with numbers become 1, otherwise 0. lenum.equal = Equal. Coerces types.\nNon-null objects compared with numbers become 1, otherwise 0.
lenum.notequal = Not equal. Coerces types. lenum.notequal = Not equal. Coerces types.
lenum.strictequal = Strict equality. Does not coerce types.\nCan be used to check for [accent]null[]. lenum.strictequal = Strict equality. Does not coerce types.\nCan be used to check for [accent]null[].
lenum.shl = Bit-shift left. lenum.shl = Bit-shift left.
lenum.shr = Bit-shift right. lenum.shr = Bit-shift right.
lenum.ushr = Unsigned bit-shift right.
lenum.or = Bitwise OR. lenum.or = Bitwise OR.
lenum.land = Logical AND. lenum.land = Logical AND.
lenum.and = Bitwise AND. lenum.and = Bitwise AND.

View File

@@ -11,6 +11,7 @@ public enum LogicOp{
div("/", (a, b) -> a / b), div("/", (a, b) -> a / b),
idiv("//", (a, b) -> Math.floor(a / b)), idiv("//", (a, b) -> Math.floor(a / b)),
mod("%", (a, b) -> a % b), mod("%", (a, b) -> a % b),
emod("%%", (a, b) -> ((a % b) + b) % b),
pow("^", Math::pow), pow("^", Math::pow),
equal("==", (a, b) -> Math.abs(a - b) < 0.000001 ? 1 : 0, (a, b) -> Structs.eq(a, b) ? 1 : 0), equal("==", (a, b) -> Math.abs(a - b) < 0.000001 ? 1 : 0, (a, b) -> Structs.eq(a, b) ? 1 : 0),
@@ -24,6 +25,7 @@ public enum LogicOp{
shl("<<", (a, b) -> (long)a << (long)b), shl("<<", (a, b) -> (long)a << (long)b),
shr(">>", (a, b) -> (long)a >> (long)b), shr(">>", (a, b) -> (long)a >> (long)b),
ushr(">>>", (a, b) -> (long)a >>> (long)b),
or("or", (a, b) -> (long)a | (long)b), or("or", (a, b) -> (long)a | (long)b),
and("b-and", (a, b) -> (long)a & (long)b), and("b-and", (a, b) -> (long)a & (long)b),
xor("xor", (a, b) -> (long)a ^ (long)b), xor("xor", (a, b) -> (long)a ^ (long)b),