Add rounddown_pow_of_two.
This commit is contained in:
parent
7d1de5ea18
commit
6727e543c7
10
sys/external/bsd/drm2/include/linux/log2.h
vendored
10
sys/external/bsd/drm2/include/linux/log2.h
vendored
@ -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 @@ roundup_pow_of_two(unsigned long n)
|
||||
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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user