librfn
An ad-hoc utility library
bitops.h
Go to the documentation of this file.
1 /*
2  * bitops.h
3  *
4  * Part of librfn (a general utility library from redfelineninja.org.uk)
5  *
6  * Copyright (C) 2012 Daniel Thompson <daniel@redfelineninja.org.uk>
7  * Copyright (C) 2014 Daniel Thompson <daniel@redfelineninja.org.uk>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU Lesser General Public License as published
11  * by the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  */
14 
15 #ifndef RF_BITOPS_H_
16 #define RF_BITOPS_H_
17 
18 #include <stdint.h>
19 
33 int bitcnt(uint32_t x);
34 
38 int clz(uint32_t x);
39 
43 int ctz(uint32_t x);
44 
48 int ilog2(uint32_t x);
49 
51 #endif // RF_BITOPS_H_
int bitcnt(uint32_t x)
Definition: bitops.c:20
int ctz(uint32_t x)
Definition: bitops.c:46
int ilog2(uint32_t x)
Definition: bitops.c:51
int clz(uint32_t x)
Definition: bitops.c:36