Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/riastradh-drm2]: src/sys/external/bsd/drm2/include/linux Implement hash_...
details: https://anonhg.NetBSD.org/src/rev/647698ba6c02
branches: riastradh-drm2
changeset: 788135:647698ba6c02
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Jul 24 02:24:02 2013 +0000
description:
Implement hash_long in <linux/hash.h>.
Uses the same hash function as in Linux, implemented differently.
diffstat:
sys/external/bsd/drm2/include/linux/hash.h | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diffs (25 lines):
diff -r d95d07fac9ea -r 647698ba6c02 sys/external/bsd/drm2/include/linux/hash.h
--- a/sys/external/bsd/drm2/include/linux/hash.h Wed Jul 24 02:23:48 2013 +0000
+++ b/sys/external/bsd/drm2/include/linux/hash.h Wed Jul 24 02:24:02 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hash.h,v 1.1.2.1 2013/07/24 00:33:12 riastradh Exp $ */
+/* $NetBSD: hash.h,v 1.1.2.2 2013/07/24 02:24:02 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,4 +32,15 @@
#ifndef _LINUX_HASH_H_
#define _LINUX_HASH_H_
+#include <machine/limits.h>
+
+static inline unsigned long
+hash_long(unsigned long value, unsigned int bits)
+{
+ const unsigned long factor = (sizeof(factor) > 4?
+ 0x9e37fffffffc0001ull : 0x9e370001ul);
+
+ return ((value * factor) >> ((CHAR_BIT * sizeof(value)) - bits));
+}
+
#endif /* _LINUX_HASH_H_ */
Home |
Main Index |
Thread Index |
Old Index