#ifndef THREADLOCALUTILS_H #define THREADLOCALUTILS_H #include #include #include #define TOPIC_MEMORY_LENGTH 65560 /** * @brief The Utils class have utility functions that make use of pre-allocated memory. Use with thread_local or create per thread manually. */ class Utils { std::vector subtopics; std::vector subtopicParseMem; std::vector topicCopy; __m128i slashes = _mm_set1_epi8('/'); __m128i lowerBound = _mm_set1_epi8(0x20); __m128i lastAsciiChar = _mm_set1_epi8(0x7E); __m128i non_ascii_mask = _mm_set1_epi8(0b10000000); __m128i pound = _mm_set1_epi8('#'); __m128i plus = _mm_set1_epi8('+'); public: Utils(); std::vector *splitTopic(const std::string &topic); bool isValidUtf8(const std::string &s, bool alsoCheckInvalidPublishChars = false); }; #endif // THREADLOCALUTILS_H