diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2019-08-21 17:16:08 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2019-08-21 17:16:08 +0200 |
commit | 4fa0e472cf3e8c61a3f67e91d201dbc12ea94221 (patch) | |
tree | 7a932b33d0328c59990cf31123b949151a4a5626 /lib/bitops.h | |
parent | 524d2538537b2530bf031daa1d5c8e4653f92c5c (diff) |
BGP: Use reallocation for capability structure
Instead of having large stack buffer for max amount of AFI/SAFI pairs.
The old code is not correct w.r.t. extendeded option length, as more
AFI/SAFI pairs may fit into the capability option.
Diffstat (limited to 'lib/bitops.h')
-rw-r--r-- | lib/bitops.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/bitops.h b/lib/bitops.h index af648c26..39ade388 100644 --- a/lib/bitops.h +++ b/lib/bitops.h @@ -29,4 +29,6 @@ static inline u32 u32_hash(u32 v) { return v * 2902958171u; } static inline u8 u32_popcount(u32 v) { return __builtin_popcount(v); } +static inline int uint_is_pow2(uint n) { return n && !(n & (n-1)); } + #endif |