Added xor (^) operator to constant expressions
This commit is contained in:
parent
364b08531b
commit
c6b3e619c3
2 changed files with 3 additions and 0 deletions
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -387,6 +387,7 @@ Evaluated strictly left to right:
|
||||||
- `/` Division
|
- `/` Division
|
||||||
- `|` Bitwise OR
|
- `|` Bitwise OR
|
||||||
- `&` Bitwise AND
|
- `&` Bitwise AND
|
||||||
|
- `^` Bitwise XOR
|
||||||
|
|
||||||
### Constants
|
### Constants
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue