@@ -104,15 +104,19 @@ void detect_cpu_features(cpu_flags *flags) {
104104 }
105105}
106106
107+ #ifdef HACL_CAN_COMPILE_SIMD128
107108static inline bool has_simd128 (cpu_flags * flags ) {
108109 // For now this is Intel-only, could conceivably be #ifdef'd to something
109110 // else.
110111 return flags -> sse && flags -> sse2 && flags -> sse3 && flags -> sse41 && flags -> sse42 && flags -> cmov ;
111112}
113+ #endif
112114
115+ #ifdef HACL_CAN_COMPILE_SIMD256
113116static inline bool has_simd256 (cpu_flags * flags ) {
114117 return flags -> avx && flags -> avx2 ;
115118}
119+ #endif
116120
117121// Small mismatch between the variable names Python defines as part of configure
118122// at the ones HACL* expects to be set in order to enable those headers.
@@ -151,13 +155,15 @@ blake2_get_state(PyObject *module)
151155 return (Blake2State * )state ;
152156}
153157
158+ #if defined(HACL_CAN_COMPILE_SIMD128 ) || defined(HACL_CAN_COMPILE_SIMD256 )
154159static inline Blake2State *
155160blake2_get_state_from_type (PyTypeObject * module )
156161{
157162 void * state = _PyType_GetModuleState (module );
158163 assert (state != NULL );
159164 return (Blake2State * )state ;
160165}
166+ #endif
161167
162168static struct PyMethodDef blake2mod_functions [] = {
163169 {NULL , NULL }
@@ -311,7 +317,9 @@ static inline bool is_blake2s(blake2_impl impl) {
311317}
312318
313319static inline blake2_impl type_to_impl (PyTypeObject * type ) {
320+ #if defined(HACL_CAN_COMPILE_SIMD128 ) || defined(HACL_CAN_COMPILE_SIMD256 )
314321 Blake2State * st = blake2_get_state_from_type (type );
322+ #endif
315323 if (!strcmp (type -> tp_name , blake2b_type_spec .name )) {
316324#ifdef HACL_CAN_COMPILE_SIMD256
317325 if (has_simd256 (& st -> flags ))
0 commit comments