mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-10-13 07:25:54 -04:00
6e7a9b47f0
Shifting a signed 1 into the sign bit is undefined, and UBSan reports it as "left shift of 1 by 31 places cannot be represented in type 'int'". The switch-flag helpers in z_actor.c take the bit position at runtime, so every flag from 0x00 to 0x3F goes through the same shift. Flag 0x3F lands on bit 31: the Potion Shop Granny sets and clears it while brewing the Odd Potion, so this is reached in ordinary play, not just in theory. The same shift appears as a constant in gBitFlags, in the two player state flags that occupy bit 31, and in ENHORSE_FLAG_31. Suffixing the 1 with u moves the shift to unsigned, where the value is defined. Every flag field involved is already u32, so the results are unchanged.