Files
Shipwright/soh/include
David Racine 6e7a9b47f0 Fix undefined left shifts of 1 by 31 (#6640)
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.
2026-10-09 13:49:46 +00:00
..
2024-10-28 17:30:11 -07:00
2022-11-30 00:28:57 +01:00
2022-05-11 13:18:24 -04:00
2023-06-01 21:39:50 -04:00
2025-03-30 12:29:59 -04:00
2022-09-21 00:50:22 -04:00
2023-11-19 02:38:07 -05:00
2022-08-31 22:59:38 -04:00
2026-10-05 05:19:52 +00:00
2023-01-17 00:33:56 -05:00
2023-01-17 00:33:56 -05:00
2023-11-19 02:38:07 -05:00
2022-06-22 23:13:32 -04:00
2026-06-04 02:34:50 +00:00
2023-01-17 00:33:56 -05:00
2026-10-05 05:19:52 +00:00
2023-11-19 02:38:07 -05:00