From f2f69d6d18e240931ba825633108107e948c1984 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 11 Jul 2016 18:12:43 +0000 Subject: Add page size configuration option git-svn-id: http://svn.drobilla.net/zix/trunk@107 df6676b4-ccc9-40e5-b5d6-7c4628a128e3 --- wscript | 3 +++ zix/btree.c | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/wscript b/wscript index 1ddd4d5..d3c37a2 100644 --- a/wscript +++ b/wscript @@ -36,6 +36,8 @@ def options(opt): help='Build benchmarks') opt.add_option('--static', action='store_true', dest='static', help='Build static library') + opt.add_option('--page-size', type='int', default=4096, dest='page_size', + help='Page size for B-tree') def configure(conf): conf.load('compiler_c') @@ -66,6 +68,7 @@ def configure(conf): conf.fatal('Glib is required to build benchmarks') autowaf.define(conf, 'ZIX_VERSION', ZIX_VERSION) + autowaf.define(conf, 'ZIX_BTREE_PAGE_SIZE', Options.options.page_size) conf.write_config_header('zix-config.h', remove=False) autowaf.display_msg(conf, 'Unit tests', str(conf.env.BUILD_TESTS)) diff --git a/zix/btree.c b/zix/btree.c index 4557ad4..d28f6c2 100644 --- a/zix/btree.c +++ b/zix/btree.c @@ -24,7 +24,10 @@ // #define ZIX_BTREE_DEBUG 1 -#define ZIX_BTREE_PAGE_SIZE 4096 +#ifndef ZIX_BTREE_PAGE_SIZE +# define ZIX_BTREE_PAGE_SIZE 4096 +#endif + #define ZIX_BTREE_NODE_SPACE (ZIX_BTREE_PAGE_SIZE - 2 * sizeof(uint16_t)) #define ZIX_BTREE_LEAF_VALS ((ZIX_BTREE_NODE_SPACE / sizeof(void*)) - 1) #define ZIX_BTREE_INODE_VALS (ZIX_BTREE_LEAF_VALS / 2) -- cgit v1.2.1