OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [include/] [l4/] [lib/] [bit.h] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
#ifndef __LIB_BIT_H__
2
#define __LIB_BIT_H__
3
 
4
unsigned int __clz(unsigned int bitvector);
5
int find_and_set_first_free_bit(u32 *word, unsigned int lastbit);
6
int check_and_clear_bit(u32 *word, int bit);
7
int check_and_set_bit(u32 *word, int bit);
8
 
9
 
10
/* Set */
11
static inline void setbit(unsigned int *w, unsigned int flags)
12
{
13
        *w |= flags;
14
}
15
 
16
 
17
/* Clear */
18
static inline void clrbit(unsigned int *w, unsigned int flags)
19
{
20
        *w &= ~flags;
21
}
22
 
23
/* Test */
24
static inline int tstbit(unsigned int *w, unsigned int flags)
25
{
26
        return *w & flags;
27
}
28
 
29
/* Test and clear */
30
static inline int tstclr(unsigned int *w, unsigned int flags)
31
{
32
        int res = tstbit(w, flags);
33
 
34
        clrbit(w, flags);
35
 
36
        return res;
37
}
38
 
39
#endif /* __LIB_BIT_H__ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.