3 ms·
Assuming N-bit ints: result = pattern; result <<= N-8; result >>= N-1; ?
by tzs 5y ago
Assuming N-bit ints:
result = pattern;
result <<= N-8;
result >>= N-1;
?
- bxparks 5y ago(No one upvoted my post, so I didn't bother checking the threads, sorry for the delayed response). This was on an 8-bit microcontroller, so it was compiled to a left-shift into the carry bit, then a left-shift from the carry bit into a register that contained a 0x00.