diff options
Diffstat (limited to 'util/bufferiszero.c')
-rw-r--r-- | util/bufferiszero.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/util/bufferiszero.c b/util/bufferiszero.c index a3a842f9fd..4af3caa1b6 100644 --- a/util/bufferiszero.c +++ b/util/bufferiszero.c @@ -162,6 +162,19 @@ static void __attribute__((constructor)) init_cpuid_cache(void) cpuid_cache = cache; } +#define HAVE_NEXT_ACCEL +bool test_buffer_is_zero_next_accel(void) +{ + /* If no bits set, we just tested buffer_zero_int, and there + are no more acceleration options to test. */ + if (cpuid_cache == 0) { + return false; + } + /* Disable the accelerator we used before and select a new one. */ + cpuid_cache &= cpuid_cache - 1; + return true; +} + static bool select_accel_fn(const void *buf, size_t len) { uintptr_t ibuf = (uintptr_t)buf; @@ -180,6 +193,13 @@ static bool select_accel_fn(const void *buf, size_t len) #define select_accel_fn buffer_zero_int #endif +#ifndef HAVE_NEXT_ACCEL +bool test_buffer_is_zero_next_accel(void) +{ + return false; +} +#endif + /* * Checks if a buffer is all zeroes */ |