#include <stdio.h> /* _lrotr() A function that shifts an unsigned long integer to the left Prototype :unsigned long
_lrotr(unsigned long value,int count) function : take value Cycle left count position .
Return value : take value Cycle left count Value after bit . Header file :stdlib.h */ unsigned _rotl (unsigned val,int
shift) { register unsigned hibit; /* non-zero means hi bit set */ register
unsigned num = val; /* number to rotate */ shift &= 0x1f; /* modulo 32 -- this
will also make negative shifts work */ while (shift--) { hibit = num &
0x80000000; /* get high bit */ num <<= 1; /* shift left one bit */ if (hibit)
num |= 1; /* set lo bit if hi bit was set */ } return num; }
// This function is called _rotl Function is encapsulated again unsigned long _lrotl (unsigned long val,int shift) {
return( (unsigned long) _rotl((unsigned) val, shift) ); } /*
_lrotr() A function that shifts an unsigned long integer to the right Prototype :unsigned long _lrotr(unsigned long value,int
count) function : take value Cycle right count position . Return value : take value Cycle right count Value after bit . Header file :stdlib.h */
unsigned _rotr (unsigned val,int shift) { register unsigned lobit; /* non-zero
means lo bit set */ register unsigned num = val; /* number to rotate */ shift
&= 0x1f; /* modulo 32 -- this will also make negative shifts work */ while
(shift--) { lobit = num & 1; /* get high bit */ num >>= 1; /* shift right one
bit */ if (lobit) num |= 0x80000000; /* set hi bit if lo bit was set */ }
return num; } // Encapsulate the right shift function again unsigned long _lrotr (unsigned long val,int shift) {
return( (unsigned long) _rotr((unsigned) val, shift) ); } int main(void) {
unsigned long val = 2; unsigned long ret = _lrotl(val , 4) ;
printf("%d\n",ret); unsigned long r = _lrotr(ret,4); printf("%d\n",r); return 0
; } Operation results :32 2

Technology
©2020 ioDraw All rights reserved
Programmer interview asked “ What are your shortcomings ”, How to answer ?C language : Digital puzzle games JavaScript study ( Scope )java object-oriented 4- Code block python: Einstein ladder problem Morphological processing gradient , Top hat , Black hat Why automated testing ? What kind of project is suitable for automated testing ?CCF A series of questions --2016 year 4 Month 1 Calculation of break point filemanager-webpack-plugin Turn resources into zip Package and archive Python be based on Django Design of course selection system for student educational administration