Skip to content

Commit

Permalink
Add SHUFFLE_USE_* macros to check if instruction set is really available
Browse files Browse the repository at this point in the history
  • Loading branch information
t20100 authored and FrancescAlted committed Dec 14, 2022
1 parent 78a557c commit dd57c03
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions blosc/shuffle.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,25 @@

#include "blosc2/blosc2-common.h"

/* Toggle hardware-accelerated routines based on SHUFFLE_*_ENABLED macros
and availability on the target architecture.
*/
#if defined(SHUFFLE_AVX2_ENABLED) && defined(__AVX2__)
#define SHUFFLE_USE_AVX2
#endif

#if defined(SHUFFLE_SSE2_ENABLED) && defined(__SSE2__)
#define SHUFFLE_USE_SSE2
#endif

#if defined(SHUFFLE_ALTIVEC_ENABLED) && defined(__ALTIVEC__)
#define SHUFFLE_USE_ALTIVEC
#endif

#if defined(SHUFFLE_NEON_ENABLED) && defined(__ARM_NEON)
#define SHUFFLE_USE_NEON
#endif

#ifdef __cplusplus
extern "C" {
#endif
Expand Down

0 comments on commit dd57c03

Please sign in to comment.