Rev 6082 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6082 | Rev 6102 | ||
---|---|---|---|
Line 105... | Line 105... | ||
105 | * @word: value to rotate |
105 | * @word: value to rotate |
106 | * @shift: bits to roll |
106 | * @shift: bits to roll |
107 | */ |
107 | */ |
108 | static inline __u32 rol32(__u32 word, unsigned int shift) |
108 | static inline __u32 rol32(__u32 word, unsigned int shift) |
109 | { |
109 | { |
110 | return (word << shift) | (word >> (32 - shift)); |
110 | return (word << shift) | (word >> ((-shift) & 31)); |
111 | } |
111 | } |
Line 112... | Line 112... | ||
112 | 112 | ||
113 | /** |
113 | /** |
114 | * ror32 - rotate a 32-bit value right |
114 | * ror32 - rotate a 32-bit value right |