Skip to content

Conversation

@pitust
Copy link

@pitust pitust commented Nov 16, 2024

The current implementation of the M4 macro leads to a signed integer overflow error, which is undefined behavior:

The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated bits are filled with zeros. If E1 has
an unsigned type, the value of the result is E1 × 2E2, wrapped around. If E1 has a signed type and
nonnegative value, and E1 × 2^E2 is representable in the result type, then that is the resulting value;
otherwise, the behavior is undefined

(emphasis added, N3219 6.5.8.5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant