For an assignment, I\'m trying to make some code in C that uses only bit manipulation to test if an integer is an ASCII uppercase letter. The letter will be given by its ASCII c
Since OP is stuck on case 0x7fffffff, exclude it by extending the otherwise working solution.
0x7fffffff
!((~(((x & 32)>>5))<<31))>>31) & !(x ^ 0x7fffffff)
Pedantically, just code as below and let the compiler simplify.
isupper = (!(x ^ 'A')) | (!(x ^ 'B')) | (!(x ^ 'C')) ... (!(x ^ 'Z'));