aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile6
-rw-r--r--config.c19
2 files changed, 24 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 5d625fb..02431a7 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ config_C_SOURCES = config.c
config_OBJECTS = $(patsubst %.c,%.o,$(config_C_SOURCES))
config_TARGET = config
-.PHONY: all clean
+.PHONY: all clean cleanconfig
all: $(mulklib_TARGET) $(bpttest_TARGET)
@@ -32,6 +32,10 @@ clean:
$(RM_F) $(config_OBJECTS)
$(RM_F) $(config_TARGET)
+cleanconfig:
+ $(RM_F) $(config_OBJECTS)
+ $(RM_F) $(config_TARGET)
+
$(mulklib_TARGET): $(mulklib_OBJECTS)
$(LIBTOOL) -dynamic $(LDFLAGS) -o $@ $(mulklib_OBJECTS)
diff --git a/config.c b/config.c
new file mode 100644
index 0000000..e86de89
--- /dev/null
+++ b/config.c
@@ -0,0 +1,19 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <math.h>
+
+typedef BPT_KEY_T bpt_key_t;
+typedef BPT_KEY_BITMASK_T bpt_key_bitmask_t;
+
+int main() {
+ long chunk_length = (int)log2(sizeof(bpt_key_bitmask_t)*8);
+ long key_length = sizeof(bpt_key_t)*8;
+ long offset_mask = ((1 << chunk_length) - 1);
+ long max_chunks = key_length / chunk_length + ((key_length % chunk_length == 0) ? 0 : 1);
+ long last_chunk_length = key_length - ((max_chunks - 1) * chunk_length);
+ printf("-DCHUNK_LENGTH=%ld -DKEY_LENGTH=%ld -DOFFSET_MASK=%ld -DMAX_CHUNKS=%ld -DLAST_CHUNK_LENGTH=%ld",
+ chunk_length, key_length, offset_mask, max_chunks, last_chunk_length);
+ return EXIT_SUCCESS;
+}
+