RotateDefs.h 656 B

123456789101112131415161718192021222324252627282930
  1. /* RotateDefs.h -- Rotate functions
  2. 2015-03-25 : Igor Pavlov : Public domain */
  3. #ifndef __ROTATE_DEFS_H
  4. #define __ROTATE_DEFS_H
  5. #ifdef _MSC_VER
  6. #include <stdlib.h>
  7. /* don't use _rotl with MINGW. It can insert slow call to function. */
  8. /* #if (_MSC_VER >= 1200) */
  9. #pragma intrinsic(_rotl)
  10. #pragma intrinsic(_rotr)
  11. /* #endif */
  12. #define rotlFixed(x, n) _rotl((x), (n))
  13. #define rotrFixed(x, n) _rotr((x), (n))
  14. #else
  15. /* new compilers can translate these macros to fast commands. */
  16. #define rotlFixed(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
  17. #define rotrFixed(x, n) (((x) >> (n)) | ((x) << (32 - (n))))
  18. #endif
  19. #endif