github.com/Schaudge/grailbase@v0.0.0-20240223061707-44c758a471c0/compress/libdeflate/decompress_impl.h (about)

     1  #ifndef GO_SRC_GITHUB_COM_GRAILBIO_BASE_COMPRESS_LIBDEFLATE_DECOMPRESS_IMPL_H_
     2  #define GO_SRC_GITHUB_COM_GRAILBIO_BASE_COMPRESS_LIBDEFLATE_DECOMPRESS_IMPL_H_
     3  
     4  #include "cpu_features.h"
     5  
     6  /* Include the BMI2-optimized version? */
     7  #undef DISPATCH_BMI2
     8  #if !defined(__BMI2__) && X86_CPU_FEATURES_ENABLED && \
     9  	COMPILER_SUPPORTS_BMI2_TARGET
    10  #  define FUNCNAME	deflate_decompress_bmi2
    11  #  define ATTRIBUTES	__attribute__((target("bmi2")))
    12  #  define DISPATCH	1
    13  #  define DISPATCH_BMI2	1
    14  #  include "decompress_template.h"
    15  #endif
    16  
    17  #ifdef DISPATCH
    18  static inline decompress_func_t
    19  arch_select_decompress_func(void)
    20  {
    21  	u32 features = get_cpu_features();
    22  
    23  #ifdef DISPATCH_BMI2
    24  	if (features & X86_CPU_FEATURE_BMI2)
    25  		return deflate_decompress_bmi2;
    26  #endif
    27  	return NULL;
    28  }
    29  #endif /* DISPATCH */
    30  
    31  #endif  // GO_SRC_GITHUB_COM_GRAILBIO_BASE_COMPRESS_LIBDEFLATE_DECOMPRESS_IMPL_H_  NOLINT(whitespace/line_length)