# Bit Opertors in Calculated Properties??

Hello!

Is there a nomenclature for using bit operators in a Calculated Property? None of my [CP] evaluate when I utilize bit operators (>>, <<, ^, &, |).

E.g., [CP} RotArcMask = (arcMask << (Facing - 1)) ^ (arcMask >> (7-Facing))

= 0

Is there a work-a-round? Am I using the right symbology for bit-ops in Vassal?

Thanks,
Flane

I have tried putting in curly braces to separate the operators with out success.

are you sure you dont want

|| means OR in vassal as opposed to ^

also >> , << are shift operators (makes a 1 a 0 or a 0 a 1 etcâ€¦) not the standard math greater than or less than operators which are < and > which I believe you want to do?

No, I am trying to implement a means to wrap a N-bit pattern where the left most bit moves to the farthest right bit position before continuing its next left shift operation. The pattern represents the hexside (1-6) where a legal firing arc exists. As the Facing changes, the bit pattern must be rotated to match up with the facing of the unit.

Will the bit operators function in a CalcProperty?

Thanks for the suggestion and help!

Flane

I have checked the source and done a quick test to confirm that shift and bit operators are definitely implemented and working. A simple Calculated property 16 << 2 displays as 64 and 16 >> 2 displays as 4 as you would expect. Based on your example, I set the CP expression value as

(7 << (3 - 1)) ^ (7 >> (7-3))

and the result was 28.

I would suggest using a Text label to first make sure arcMask and Facing have the values you expect in them, then build up the CP piece by piece and display the output after you add each element to see what is going wrong.

Regards,
Brent.

Excellent advice. I found a capitalization mistake early on which was mucking up the rest of the equation. How embarrassingâ€¦

Thanks,

Flaney