How to convert lower case ASCII char into upper case using a bitmask (no -32 allowed)?
I'm not asking for solving my homework, only some hints.
Thanks
As you state "(no -32 allowed)", I guess you know that the difference between lower case characters and upper case characters is 32. Now convert 32 to its binary representation, there's only one bit set. After that, work out a way to use a bit mask to switch the bit.
Think about the differential between lower and upper case (0x20) and then apply the appropriate mask to your value
XOR to get lower from upper or upper from lower
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With