Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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));
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #bit #shift #wrap
ADD COMMENT
Topic
Name
1+1 =