Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/common/include/linux Add fls to <linux/bito...



details:   https://anonhg.NetBSD.org/src/rev/eb2e828eaa46
branches:  trunk
changeset: 992574:eb2e828eaa46
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 07:04:32 2018 +0000

description:
Add fls to <linux/bitops.h>.

diffstat:

 sys/external/bsd/common/include/linux/bitops.h |  12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diffs (26 lines):

diff -r 5ec413267a83 -r eb2e828eaa46 sys/external/bsd/common/include/linux/bitops.h
--- a/sys/external/bsd/common/include/linux/bitops.h    Mon Aug 27 07:04:22 2018 +0000
+++ b/sys/external/bsd/common/include/linux/bitops.h    Mon Aug 27 07:04:32 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bitops.h,v 1.3 2018/08/27 06:54:29 riastradh Exp $     */
+/*     $NetBSD: bitops.h,v 1.4 2018/08/27 07:04:32 riastradh Exp $     */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -62,6 +62,16 @@
        return ffs64(x) - 1;
 }
 
+/*
+ * Linux fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32, so it matches
+ * our fls semantics.
+ */
+static inline int
+fls(int x)
+{
+       return fls32(x);
+}
+
 static inline unsigned int
 hweight16(uint16_t n)
 {



Home | Main Index | Thread Index | Old Index