Added xor (^) operator to constant expressions

This commit is contained in:
Mattias Hansson 2025-11-20 22:01:23 +01:00
parent 364b08531b
commit c6b3e619c3
2 changed files with 3 additions and 0 deletions

View file

@ -203,6 +203,8 @@ func EvaluateExpression(expr string, lookup ConstantLookup) (int64, error) {
result = result | nextVal result = result | nextVal
case '&': case '&':
result = result & nextVal result = result & nextVal
case '^':
result = result ^ nextVal
default: default:
return 0, fmt.Errorf("unknown operator %q", op) return 0, fmt.Errorf("unknown operator %q", op)
} }

View file

@ -387,6 +387,7 @@ Evaluated strictly left to right:
- `/` Division - `/` Division
- `|` Bitwise OR - `|` Bitwise OR
- `&` Bitwise AND - `&` Bitwise AND
- `^` Bitwise XOR
### Constants ### Constants