blake2-config.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. BLAKE2 reference source code package - optimized C implementations
  3. Written in 2012 by Samuel Neves <sneves@dei.uc.pt>
  4. To the extent possible under law, the author(s) have dedicated all copyright
  5. and related and neighboring rights to this software to the public domain
  6. worldwide. This software is distributed without any warranty.
  7. You should have received a copy of the CC0 Public Domain Dedication along with
  8. this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
  9. */
  10. #pragma once
  11. #ifndef __BLAKE2_CONFIG_H__
  12. #define __BLAKE2_CONFIG_H__
  13. #if defined(__SSE2__)
  14. #define HAVE_SSE2
  15. #endif
  16. #if defined(__SSSE3__)
  17. #define HAVE_SSSE3
  18. #endif
  19. #if defined(__SSE4_1__)
  20. #define HAVE_SSE4_1
  21. #endif
  22. #if defined(__AVX__)
  23. #define HAVE_AVX
  24. #endif
  25. #if defined(__XOP__)
  26. #define HAVE_XOP
  27. #endif
  28. #ifdef HAVE_AVX2
  29. #ifndef HAVE_AVX
  30. #define HAVE_AVX
  31. #endif
  32. #endif
  33. #ifdef HAVE_XOP
  34. #ifndef HAVE_AVX
  35. #define HAVE_AVX
  36. #endif
  37. #endif
  38. #ifdef HAVE_AVX
  39. #ifndef HAVE_SSE4_1
  40. #define HAVE_SSE4_1
  41. #endif
  42. #endif
  43. #ifdef HAVE_SSE4_1
  44. #ifndef HAVE_SSSE3
  45. #define HAVE_SSSE3
  46. #endif
  47. #endif
  48. #ifdef HAVE_SSSE3
  49. #define HAVE_SSE2
  50. #endif
  51. #if !defined(HAVE_SSE2)
  52. #error "This code requires at least SSE2."
  53. #endif
  54. #endif