@@ -104,15 +104,19 @@ void detect_cpu_features(cpu_flags *flags) {
104
104
}
105
105
}
106
106
107
+ #ifdef HACL_CAN_COMPILE_SIMD128
107
108
static inline bool has_simd128 (cpu_flags * flags ) {
108
109
// For now this is Intel-only, could conceivably be #ifdef'd to something
109
110
// else.
110
111
return flags -> sse && flags -> sse2 && flags -> sse3 && flags -> sse41 && flags -> sse42 && flags -> cmov ;
111
112
}
113
+ #endif
112
114
115
+ #ifdef HACL_CAN_COMPILE_SIMD256
113
116
static inline bool has_simd256 (cpu_flags * flags ) {
114
117
return flags -> avx && flags -> avx2 ;
115
118
}
119
+ #endif
116
120
117
121
// Small mismatch between the variable names Python defines as part of configure
118
122
// at the ones HACL* expects to be set in order to enable those headers.
@@ -151,13 +155,15 @@ blake2_get_state(PyObject *module)
151
155
return (Blake2State * )state ;
152
156
}
153
157
158
+ #if defined(HACL_CAN_COMPILE_SIMD128 ) || defined(HACL_CAN_COMPILE_SIMD256 )
154
159
static inline Blake2State *
155
160
blake2_get_state_from_type (PyTypeObject * module )
156
161
{
157
162
void * state = _PyType_GetModuleState (module );
158
163
assert (state != NULL );
159
164
return (Blake2State * )state ;
160
165
}
166
+ #endif
161
167
162
168
static struct PyMethodDef blake2mod_functions [] = {
163
169
{NULL , NULL }
@@ -311,7 +317,9 @@ static inline bool is_blake2s(blake2_impl impl) {
311
317
}
312
318
313
319
static inline blake2_impl type_to_impl (PyTypeObject * type ) {
320
+ #if defined(HACL_CAN_COMPILE_SIMD128 ) || defined(HACL_CAN_COMPILE_SIMD256 )
314
321
Blake2State * st = blake2_get_state_from_type (type );
322
+ #endif
315
323
if (!strcmp (type -> tp_name , blake2b_type_spec .name )) {
316
324
#ifdef HACL_CAN_COMPILE_SIMD256
317
325
if (has_simd256 (& st -> flags ))
0 commit comments