c++ bit shift wrap code example
Example 1: c++ bit shift wrap
uint8_t a = 124;
uint8_t aShifted = leftBitshiftWrap(a,2);
uint8_t leftBitshiftWrap_uint8_t(uint8_t val, uint8_t amt){
return (val << amt) | (val >> (8-amt));
}
Example 2: get bitshift to wrap c++
//Rotating integers are done as follows
letter = ((unsigned char)letter >> 1) | (letter << 7);