Skip to content

Commit c5bdf15

Browse files
committed
WIP
1 parent a1457f5 commit c5bdf15

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

Hashes.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,10 +1278,23 @@ void crc32c_pclmul_test(const void *key, int len, uint32_t seed, void *out)
12781278
#endif
12791279

12801280
#include "hash-garage/nmhash.h"
1281-
const char * const nmhash32_ver("nmhash32, le:" MACRO_ITOA(NMHASH_LITTLE_ENDIAN) ", vector:" MACRO_ITOA(NMH_VECTOR) ", align:" MACRO_ITOA(NMH_ACC_ALIGN));
1282-
const char * const nmhash32x_ver("nmhash32x, le:" MACRO_ITOA(NMHASH_LITTLE_ENDIAN) ", vector:" MACRO_ITOA(NMH_VECTOR) ", align:" MACRO_ITOA(NMH_ACC_ALIGN));
1281+
#define NMHASH32_DESC_STR "le:" MACRO_ITOA(NMHASH_LITTLE_ENDIAN) ", " \
1282+
"vector:" MACRO_ITOA(NMH_VECTOR) ", " \
1283+
"align:" MACRO_ITOA(NMH_ACC_ALIGN) ", "
1284+
1285+
const char * const nmhash32_ver("nmhash32, " NMHASH32_DESC_STR);
1286+
const char * const nmhash32x_ver("nmhash32x, " NMHASH32_DESC_STR);
1287+
constexpr unsigned sizeof_NMH_ACC_INIT = sizeof(NMH_ACC_INIT);
1288+
constexpr unsigned countof_NMH_ACC_INIT = sizeof(NMH_ACC_INIT)/sizeof(*NMH_ACC_INIT);
12831289
// objsize: 4202f0-420c7d: 2445
12841290
void nmhash32_test ( const void * key, int len, uint32_t seed, void * out ) {
1291+
static bool once = false;
1292+
if (!once) {
1293+
NMH_ALIGN(NMH_ACC_ALIGN) uint32_t accX[sizeof(NMH_ACC_INIT)/sizeof(*NMH_ACC_INIT)];
1294+
NMH_ALIGN(NMH_ACC_ALIGN) uint32_t accY[sizeof(accX)/sizeof(*accX)];
1295+
printf("sizeof_NMH_ACC_INIT: %u\ncountof_NMH_ACC_INIT: %u\nsizeof(accX): %u\nsizeof(accY): %u\n", sizeof_NMH_ACC_INIT, countof_NMH_ACC_INIT, sizeof(accX), sizeof(accY));
1296+
once = true;
1297+
}
12851298
const uint32_t v = NMHASH32 (key, (const size_t) len, seed);
12861299
printf("NMHASH32(%p, %d, %u) = %u\n", key, len, seed, v);
12871300
*(uint32_t*)out = v;

0 commit comments

Comments
 (0)