Hello Mike,
thank you very much for this report. You have encountered an error in Chora compiler. The ~ operator seems to accept 32-bit signed/unsigned operands only. The constant number 1, however, is considered as int8 value. The Chora compiler reports thereupon an error message. We will fix the error in the next version.
Trying to cast the value explicitly to int32 does not work because of optimization the constant value is re-evaluated resulting again in int8. Following are the few possible workarounds to achieve your desired results:
Option 1:
var uint8 x = ...;
var int32 val1 = 1;
x = uint8( x & ~( val1 << 0 ));
Option 2:
var uint8 x = ...;
x = uint8( x & (( 1 << 0 ) ^ 0xFFFFFFFF ));
I hope the workarounds help you further.
Best regards
Paul Banach