From 3298ac1e93742e7a1ef5c4dc2e9b603dfa89d3cb Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Fri, 29 Dec 2023 17:43:50 -0800 Subject: fixes #1740 Public ID hash API This includes a manual page documenting the entire set of functions in one step. The hash is 64-bit based for now, to be maximally flexible. An internal 32-bit convenience for the common internal use is also provided (not public). The public API includes a test suite. --- src/core/id_test.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/core/id_test.c') diff --git a/src/core/id_test.c b/src/core/id_test.c index b948cc13..78be63b8 100644 --- a/src/core/id_test.c +++ b/src/core/id_test.c @@ -1,5 +1,5 @@ // -// Copyright 2021 Staysail Systems, Inc. +// Copyright 2023 Staysail Systems, Inc. // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -39,7 +39,7 @@ void test_random(void) { int i; - uint32_t id; + uint64_t id; for (i = 0; i < 2; i++) { nni_id_map m; nni_id_map_init(&m, 0, 0, true); @@ -94,7 +94,7 @@ void test_not_found(void) { nni_id_map m; - uint32_t id; + uint64_t id; nni_id_map_init(&m, 0, 0, false); NUTS_PASS(nni_id_alloc(&m, &id, &id)); @@ -137,7 +137,7 @@ test_dynamic(void) { nni_id_map m; int expect[5]; - uint32_t id; + uint64_t id; nni_id_map_init(&m, 10, 13, false); @@ -175,7 +175,7 @@ test_set_out_of_range(void) // We can insert outside the range forcibly. NUTS_PASS(nni_id_set(&m, 1, &x)); NUTS_PASS(nni_id_set(&m, 100, &x)); - NUTS_PASS(nni_id_alloc(&m, &id, &x)); + NUTS_PASS(nni_id_alloc32(&m, &id, &x)); NUTS_TRUE(id == 10); nni_id_map_fini(&m); } -- cgit v1.2.3-70-g09d2