From 0704145218ad4fe6be3c3fe256db3db852f88ec7 Mon Sep 17 00:00:00 2001 From: Ruben Vorderman Date: Mon, 8 Apr 2024 10:51:07 +0200 Subject: [PATCH] Rewrite ascii check to allow compiler auto vectorization --- src/dnaio/ascii_check.h | 70 +++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 30 deletions(-) diff --git a/src/dnaio/ascii_check.h b/src/dnaio/ascii_check.h index e35f435..63e33a4 100644 --- a/src/dnaio/ascii_check.h +++ b/src/dnaio/ascii_check.h @@ -1,12 +1,18 @@ #include -#include -#ifdef __SSE2__ -#include "emmintrin.h" -#endif #define ASCII_MASK_8BYTE 0x8080808080808080ULL #define ASCII_MASK_1BYTE 0x80 +static inline int string_is_ascii_fallback(const char *string, size_t length) +{ + /* Combining all characters with OR allows for only one bit check at the end */ + size_t all_chars = 0; + for (size_t i=0; i