Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm2/include/linux Add rounddown_pow_of_two.
details: https://anonhg.NetBSD.org/src/rev/87e34a88adca
branches: trunk
changeset: 331256:87e34a88adca
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Aug 06 14:05:08 2014 +0000
description:
Add rounddown_pow_of_two.
diffstat:
sys/external/bsd/drm2/include/linux/log2.h | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diffs (24 lines):
diff -r c8d5f33f1ed4 -r 87e34a88adca sys/external/bsd/drm2/include/linux/log2.h
--- a/sys/external/bsd/drm2/include/linux/log2.h Wed Aug 06 13:57:15 2014 +0000
+++ b/sys/external/bsd/drm2/include/linux/log2.h Wed Aug 06 14:05:08 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: log2.h,v 1.4 2014/07/16 20:59:58 riastradh Exp $ */
+/* $NetBSD: log2.h,v 1.5 2014/08/06 14:05:08 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -58,6 +58,14 @@
return (n + 1);
}
+static inline unsigned long
+rounddown_pow_of_two(unsigned long n)
+{
+
+ /* XXX fls64 is not fls_ulong, but it'll do for now. */
+ return (1UL << (fls64(n) - 1));
+}
+
static inline unsigned
order_base_2(unsigned long n)
{
Home |
Main Index |
Thread Index |
Old Index