siphash_impl.h 945 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef SIPHASH_IMPL_H
  2. #define SIPHASH_IMPL_H
  3. #include "siphash.h"
  4. #if defined(_MSC_VER)
  5. #include <intrin.h>
  6. #define INLINE __forceinline
  7. #define NOINLINE __declspec(noinline)
  8. #define ROTL64(a,b) _rotl64(a,b)
  9. #define MM16 __declspec(align(16))
  10. typedef unsigned int uint32_t;
  11. #if (_MSC_VER >= 1500)
  12. #define __SSSE3__
  13. #endif
  14. #if (_MSC_VER > 1200) || defined(_mm_free)
  15. #define __SSE2__
  16. #endif
  17. #else
  18. #define INLINE __attribute__((always_inline))
  19. #define NOINLINE __attribute__((noinline))
  20. #define ROTL64(a,b) (((a)<<(b))|((a)>>(64-b)))
  21. #define MM16 __attribute__((aligned(16)))
  22. #endif
  23. #if defined(__SSE2__)
  24. #include <emmintrin.h>
  25. typedef __m128i xmmi;
  26. typedef __m64 qmm;
  27. typedef union packedelem64_t {
  28. uint64_t u[2];
  29. xmmi v;
  30. } packedelem64;
  31. typedef union packedelem8_t {
  32. unsigned char u[16];
  33. xmmi v;
  34. } packedelem8;
  35. #endif
  36. #if defined(__SSSE3__)
  37. #include <tmmintrin.h>
  38. #endif
  39. #endif // SIPHASH_IMPL_H