| // | |
| // rotr.cpp | |
| // | |
| // Copyright (c) Microsoft Corporation. All rights reserved. | |
| // | |
| // Defines _lrotl(), _rotl(), and _rotl64(), which perform a rotate-right on an | |
| // integer. | |
| // | |
| extern "C" unsigned long __cdecl _lrotr(unsigned long value, int shift) | |
| { | |
| shift &= 0x1f; | |
| value = (value << (0x20 - shift)) | (value >> shift); | |
| return value; | |
| } | |
| extern "C" unsigned __cdecl _rotr(unsigned value, int shift) | |
| { | |
| shift &= 0x1f; | |
| value = (value << (0x20 - shift)) | (value >> shift); | |
| return value; | |
| } | |
| extern "C" unsigned __int64 __cdecl _rotr64(unsigned __int64 value, int shift) | |
| { | |
| shift &= 0x3f; | |
| value = (value << (0x40 - shift)) | (value >> shift); | |
| return value; | |
| } | |