Chromium Code Reviews| Index: src/IceUtils.h |
| diff --git a/src/IceUtils.h b/src/IceUtils.h |
| index bcbba23eeab4bc441d63e616fd5cd7ee54bc528b..cf0be63364f2eb1052073c9c501fec60d538881e 100644 |
| --- a/src/IceUtils.h |
| +++ b/src/IceUtils.h |
| @@ -78,6 +78,19 @@ public: |
| return 0; |
| return Align - Mod; |
| } |
| + |
| + // Precondition: 0 <= shift < 32 |
|
jvoung (off chromium)
2015/05/14 22:42:07
borrowed from V8 basically
|
| + static inline uint32_t rotateLeft32(uint32_t value, uint32_t shift) { |
| + if (shift == 0) |
| + return value; |
| + return (value << shift) | (value >> (32 - shift)); |
| + } |
| + |
| + static inline uint32_t rotateRight32(uint32_t value, uint32_t shift) { |
| + if (shift == 0) |
| + return value; |
| + return (value >> shift) | (value << (32 - shift)); |
| + } |
| }; |
| } // end of namespace Ice |