Clue icon indicating copy to clipboard operation
Clue copied to clipboard

Operator precedence gets messed up when using bitwise operators on bitlib mode

Open Lyrth opened this issue 1 year ago • 1 comments

There are no operator precedence rules followed when transforming bitwise operations into bitlib function calls when using --bitwise library or equivalent. The below code

print( ~2 & a == 4 * b )

will be compiled into

print(bit.bnot(bit.band(2, a==4*b)));

which would be wrong.

Lyrth avatar Nov 25 '23 20:11 Lyrth