3 ms·
Seems I must have messed something up in the initial testing. Now it outputs rol with uint8_t too. Well, that's good to know. For the record, here was what I w
by magicalhippo 8y ago
Seems I must have messed something up in the initial testing. Now it outputs rol with uint8_t too. Well, that's good to know.
For the record, here was what I was testing:
#include <iostream>
uint8_t rol(uint8_t x, uint8_t c) {
return (x << c | x >> (sizeof(x) * 8 - c));
}
int main()
{
volatile uint8_t a = 0b01010000;
volatile uint8_t b = 3;
uint8_t c = rol(a, b);
std::cout << static_cast<unsigned int>(0b10000010) << std::endl;
std::cout << static_cast<unsigned int>(c) << std::endl;
return 0;
}