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)); }