Module Name: src Committed By: riastradh Date: Mon Aug 27 07:04:32 UTC 2018
Modified Files: src/sys/external/bsd/common/include/linux: bitops.h Log Message: Add fls to <linux/bitops.h>. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/common/include/linux/bitops.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/external/bsd/common/include/linux/bitops.h diff -u src/sys/external/bsd/common/include/linux/bitops.h:1.3 src/sys/external/bsd/common/include/linux/bitops.h:1.4 --- src/sys/external/bsd/common/include/linux/bitops.h:1.3 Mon Aug 27 06:54:29 2018 +++ src/sys/external/bsd/common/include/linux/bitops.h Mon Aug 27 07:04:32 2018 @@ -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 @@ __ffs64(uint64_t x) 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) {