| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: bitops.h,v 1.10 2015/10/13 00:42:20 riastradh Exp $ */ | | 1 | /* $NetBSD: bitops.h,v 1.11 2015/10/13 00:42:59 riastradh Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2013 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2013 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Taylor R. Campbell. | | 8 | * by Taylor R. Campbell. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -34,27 +34,27 @@ | | | @@ -34,27 +34,27 @@ |
34 | | | 34 | |
35 | #include <sys/cdefs.h> | | 35 | #include <sys/cdefs.h> |
36 | #include <sys/types.h> | | 36 | #include <sys/types.h> |
37 | #include <sys/param.h> | | 37 | #include <sys/param.h> |
38 | #include <sys/atomic.h> | | 38 | #include <sys/atomic.h> |
39 | #include <sys/bitops.h> | | 39 | #include <sys/bitops.h> |
40 | | | 40 | |
41 | #include <machine/limits.h> | | 41 | #include <machine/limits.h> |
42 | | | 42 | |
43 | #include <lib/libkern/libkern.h> | | 43 | #include <lib/libkern/libkern.h> |
44 | | | 44 | |
45 | /* | | 45 | /* |
46 | * Linux __ffs/__ffs64 is zero-based; zero input is undefined. Our | | 46 | * Linux __ffs/__ffs64 is zero-based; zero input is undefined. Our |
47 | * ffs/ffs is one-based; zero input yields zero. | | 47 | * ffs/ffs64 is one-based; zero input yields zero. |
48 | */ | | 48 | */ |
49 | static inline unsigned long | | 49 | static inline unsigned long |
50 | __ffs(unsigned long x) | | 50 | __ffs(unsigned long x) |
51 | { | | 51 | { |
52 | | | 52 | |
53 | KASSERT(x != 0); | | 53 | KASSERT(x != 0); |
54 | return ffs64(x) - 1; | | 54 | return ffs64(x) - 1; |
55 | } | | 55 | } |
56 | | | 56 | |
57 | static inline unsigned long | | 57 | static inline unsigned long |
58 | __ffs64(uint64_t x) | | 58 | __ffs64(uint64_t x) |
59 | { | | 59 | { |
60 | | | 60 | |