From eea0a9fbbf1aff1eac1f17914d5c116de98e1d93 Mon Sep 17 00:00:00 2001 From: David Timber Date: Mon, 9 Aug 2021 17:30:18 +1000 Subject: Protocol and build system change ... * Use autoheader * Add --enable-minmem * Add OS code. Bin archive and protocol changed accordingly * Add instance flags in hostinfo frame. Bitfield util added for this * Add org_id in hostinfo for lineage record * SQL schema change: store integer value of hostinfo arch and os * Remove config.c * prne_index_nybin() now sets errno * Instance ids are now preserved for lineage record * Proone: remove arguments after init * Fix bug in prne_htbt_ser_bin_meta(): alloc_len is not checked --- src/bitfield.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/bitfield.h (limited to 'src/bitfield.h') diff --git a/src/bitfield.h b/src/bitfield.h new file mode 100644 index 0000000..034e439 --- /dev/null +++ b/src/bitfield.h @@ -0,0 +1,24 @@ +#pragma once +#include +#include +#include + +#include "util_ct.h" + +// This macro accepts zero +#define prne_bf_get_size(nb_bits)\ + ((nb_bits) % 8 == 0 ? (nb_bits) / 8 : (nb_bits) / 8 + 1) + +typedef void(*prne_bf_foreach_ft)( + void *ctx, + const unsigned int bit, + const bool v); + + +void prne_bf_set (uint8_t *bf, const unsigned int bit, const bool v); +bool prne_bf_test (const uint8_t *bf, const unsigned int bit); +void prne_bf_foreach ( + void *ctx, + const uint8_t *bf, + const size_t size, + prne_bf_foreach_ft f); -- cgit