X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftdb2%2Ftest%2Frun-001-encode.c;h=f04be3398ad9bb2d856dc8c6dc13435ca30341bd;hb=a2d8a4bf0c36bf312b30fdce3ae89d5f3ae21186;hp=d1b124ef034d44274d7f19fd5576a7340743defa;hpb=1a24a8708494668c07e5c02284bfc2ef3b09603b;p=ccan diff --git a/ccan/tdb2/test/run-001-encode.c b/ccan/tdb2/test/run-001-encode.c index d1b124ef..f04be339 100644 --- a/ccan/tdb2/test/run-001-encode.c +++ b/ccan/tdb2/test/run-001-encode.c @@ -1,7 +1,9 @@ #include #include #include +#include #include +#include #include #include "logging.h" @@ -27,7 +29,7 @@ int main(int argc, char *argv[]) /* We should neatly encode all values. */ for (i = 0; i < 48; i++) { - uint64_t h = 1ULL << (i < 5 ? 63 - i : 63 - 4); + uint64_t h = 1ULL << (i < 5 ? i : 4); uint64_t klen = 1ULL << (i < 16 ? i : 15); uint64_t dlen = 1ULL << i; uint64_t xlen = 1ULL << (i < 32 ? i : 31); @@ -38,7 +40,7 @@ int main(int argc, char *argv[]) ok1(rec_key_length(&rec) == klen); ok1(rec_data_length(&rec) == dlen); ok1(rec_extra_padding(&rec) == xlen); - ok1((uint64_t)rec_hash(&rec) << (64 - 5) == h); + ok1((uint64_t)rec_hash(&rec) == h); ok1(rec_zone_bits(&rec) == zbits); ok1(rec_magic(&rec) == TDB_MAGIC); }