From 6ab8d0f195459ac04575c2bd0a340688662f36da Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Thu, 21 Sep 2023 09:17:12 +0200 Subject: [PATCH] plugins/solidigm: use static log macro to calc bitmask The mask is using the log2 function which pulls in the libm. The library is not always available, e.g when building statically. This makes the whole build logic way to complex for something like this. Instead calculating during runtime the bitmask just use the static ilog macros from ccan. Signed-off-by: Daniel Wagner --- plugins/solidigm/solidigm-telemetry/nlog.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/solidigm/solidigm-telemetry/nlog.c b/plugins/solidigm/solidigm-telemetry/nlog.c index 43b8918f..926772b2 100644 --- a/plugins/solidigm/solidigm-telemetry/nlog.c +++ b/plugins/solidigm/solidigm-telemetry/nlog.c @@ -8,15 +8,16 @@ #include "nlog.h" #include "config.h" #include -#include #include +#include "ccan/ilog/ilog.h" + #define LOG_ENTRY_HEADER_SIZE 1 #define LOG_ENTRY_TIMESTAMP_SIZE 2 #define LOG_ENTRY_NUM_ARGS_MAX 8 #define LOG_ENTRY_MAX_SIZE (LOG_ENTRY_HEADER_SIZE + LOG_ENTRY_TIMESTAMP_SIZE + \ LOG_ENTRY_NUM_ARGS_MAX) -#define NUM_ARGS_MASK ((1 << ((int)log2(LOG_ENTRY_NUM_ARGS_MAX)+1)) - 1) +#define NUM_ARGS_MASK ((1 << ((int)STATIC_ILOG_32(LOG_ENTRY_NUM_ARGS_MAX))) - 1) #define MAX_HEADER_MISMATCH_TRACK 10 static int formats_find(struct json_object *formats, uint32_t val, struct json_object **format) -- 2.50.1