3 ms·
xor should toggle?
by auselen 8mo ago
xor should toggle?
- munk-a 8mo agoThat's correct, a toUpper would just use OR.
- mbreese 8mo agoI left out that the line before there was a check to make sure the input byte was between ‘a’ and ‘z’. This ensures that if the char is already upper case, you don’t do an extraneous OR. And at this point, OR, XOR, or even a subtract 0x20 would work. For some reason the LLM thought the XOR was faster. I honestly wouldn’t have thought anything of it if I hadn’t seen it written as `b ^ 0x20`.