diff options
| author | Jan Sucan <jan@jansucan.com> | 2025-11-08 19:02:25 +0100 |
|---|---|---|
| committer | Jan Sucan <jan@jansucan.com> | 2025-11-08 19:02:25 +0100 |
| commit | 6ddd4ab70fb7826f4ec2ec03667f24a43792e990 (patch) | |
| tree | b49dbd4e5a8fa93d9bc1b6c0aa46c2816fdf7a5a /ch26/26_a_1/cbits/lookup3.h | |
| parent | 4bade78170769d8f26ff709c69cfa4f37341a466 (diff) | |
26_a_1: Add solution
Diffstat (limited to 'ch26/26_a_1/cbits/lookup3.h')
| -rw-r--r-- | ch26/26_a_1/cbits/lookup3.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/ch26/26_a_1/cbits/lookup3.h b/ch26/26_a_1/cbits/lookup3.h new file mode 100644 index 0000000..7591eba --- /dev/null +++ b/ch26/26_a_1/cbits/lookup3.h @@ -0,0 +1,23 @@ +/** snippet header */
+/* save this file as lookup3.h */
+
+#ifndef _lookup3_h
+#define _lookup3_h
+
+#include <stdint.h>
+#include <sys/types.h>
+
+/* only accepts uint32_t aligned arrays of uint32_t */
+void hashword2(const uint32_t *key, /* array of uint32_t */
+ size_t length, /* number of uint32_t values */
+ uint32_t *pc, /* in: seed1, out: hash1 */
+ uint32_t *pb); /* in: seed2, out: hash2 */
+
+/* handles arbitrarily aligned arrays of bytes */
+void hashlittle2(const void *key, /* array of bytes */
+ size_t length, /* number of bytes */
+ uint32_t *pc, /* in: seed1, out: hash1 */
+ uint32_t *pb); /* in: seed2, out: hash2 */
+
+#endif /* _lookup3_h */
+/** /snippet header */
|
