summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukáš Ondráček <lukas.ondracek@nic.cz>2024-05-28 17:08:11 +0200
committerOto Šťáva <oto.stava@nic.cz>2024-06-04 17:40:55 +0200
commit05a6ab4fa6586cf387c83fffa768cf780faba035 (patch)
treeff0f412f546671fd619cd2999f9e9498d587ec71
parentrrl: renaming, movements, create defer protolayer (diff)
downloadknot-resolver-05a6ab4fa6586cf387c83fffa768cf780faba035.tar.xz
knot-resolver-05a6ab4fa6586cf387c83fffa768cf780faba035.zip
fixup! rrl: renaming, movements, create defer protolayer
-rw-r--r--lib/kru-avx2.c3
-rw-r--r--lib/kru-generic.c4
-rw-r--r--lib/kru.h1
3 files changed, 8 insertions, 0 deletions
diff --git a/lib/kru-avx2.c b/lib/kru-avx2.c
index 183ae448..453d1336 100644
--- a/lib/kru-avx2.c
+++ b/lib/kru-avx2.c
@@ -40,7 +40,9 @@
#define USE_AVX2 1
#define USE_SSE41 1
+#include "lib/defines.h"
#include "./kru.inc.c"
+KR_EXPORT
const struct kru_api KRU_AVX2 = KRU_API_INITIALIZER;
#ifdef __clang__
@@ -61,6 +63,7 @@ static void detect_CPU_avx2(void)
#else
#include "./kru.h"
+KR_EXPORT
const struct kru_api KRU_AVX2 = {NULL};
#endif
diff --git a/lib/kru-generic.c b/lib/kru-generic.c
index 71ffdd41..8d122fd8 100644
--- a/lib/kru-generic.c
+++ b/lib/kru-generic.c
@@ -14,7 +14,11 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+#include "lib/defines.h"
#include "./kru.inc.c"
+KR_EXPORT
const struct kru_api KRU_GENERIC = KRU_API_INITIALIZER;
+
+KR_EXPORT
struct kru_api KRU = KRU_API_INITIALIZER; // generic version is the default
diff --git a/lib/kru.h b/lib/kru.h
index 6972fe8e..3acf5629 100644
--- a/lib/kru.h
+++ b/lib/kru.h
@@ -80,6 +80,7 @@ struct kru_api {
uint8_t (*limited_multi_prefix_or)(struct kru *kru, uint32_t time_now,
uint8_t namespace, uint8_t key[static 16], uint8_t *prefixes, kru_price_t *prices, size_t queries_cnt, uint16_t *max_load_out);
};
+
// The functions are stored this way to make it easier to switch
// implementation based on detected CPU.
extern struct kru_api KRU;