XenevaOS
Loading...
Searching...
No Matches
Macros
bitops.h File Reference
#include <linux/kernel.h>
#include <limits.h>
#include <linux/bug.h>
#include <uapi/linux/byteorder/little_endian.h>
Include dependency graph for bitops.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define BITS_PER_LONG   32
 
#define DECLARE_BITMAP(name, bits)    unsigned long name[(bits + BITS_PER_LONG - 1) / BITS_PER_LONG]
 
#define __ALIGN_MASK(x, mask)   (((x) + (mask)) & ~(mask))
 
#define IS_ALIGNED(x, a)   (((x) & ((typeof(x))(a) - 1)) == 0)
 
#define BIT(nr)   (1UL << (nr))
 
#define BIT_MASK(nr)   (1UL << ((nr) % BITS_PER_LONG))
 
#define BITS_TO_LONGS(nr)   (((nr) + BITS_PER_LONG - 1) / BITS_PER_LONG)
 
#define test_bit(nr, addr)
 
#define set_bit(nr, addr)
 
#define clear_bit(nr, addr)
 
#define BIT_WORD(nr)   ((nr) / BITS_PER_LONG)
 
#define assign_bit(nr, addr, val)
 
#define BITS_PER_TYPE(type)   (sizeof(type) * CHAR_BIT)
 
#define ffs(x)   __builtin_ffs(x)
 
#define hweight32(w)   __builtin_popcount(w)
 
#define hweight64(w)   __builtin_popcountll(w)
 
#define change_bit(nr, addr)   __change_bit((nr), (addr))
 
#define for_each_set_bit_from(bit, addr, size)
 
#define for_each_set_bit(bit, addr, size)
 
#define for_each_clear_bit(bit, addr, size)
 
#define le32_to_cpup   __le32_to_cpup
 

Macro Definition Documentation

◆ __ALIGN_MASK

#define __ALIGN_MASK (   x,
  mask 
)    (((x) + (mask)) & ~(mask))

◆ assign_bit

#define assign_bit (   nr,
  addr,
  val 
)
Value:
do { \
if (val) \
set_bit((nr), (addr)); \
else \
clear_bit((nr), (addr)); \
} while (0)

◆ BIT

#define BIT (   nr)    (1UL << (nr))

◆ BIT_MASK

#define BIT_MASK (   nr)    (1UL << ((nr) % BITS_PER_LONG))

◆ BIT_WORD

#define BIT_WORD (   nr)    ((nr) / BITS_PER_LONG)

◆ BITS_PER_LONG

#define BITS_PER_LONG   32

◆ BITS_PER_TYPE

#define BITS_PER_TYPE (   type)    (sizeof(type) * CHAR_BIT)

◆ BITS_TO_LONGS

#define BITS_TO_LONGS (   nr)    (((nr) + BITS_PER_LONG - 1) / BITS_PER_LONG)

◆ change_bit

#define change_bit (   nr,
  addr 
)    __change_bit((nr), (addr))

◆ clear_bit

#define clear_bit (   nr,
  addr 
)
Value:
(((unsigned long*)(addr))[(nr) / BITS_PER_LONG] &= \
~(1UL << ((nr) % BITS_PER_LONG)))
#define BITS_PER_LONG
Definition bitops.h:57

◆ DECLARE_BITMAP

#define DECLARE_BITMAP (   name,
  bits 
)     unsigned long name[(bits + BITS_PER_LONG - 1) / BITS_PER_LONG]

◆ ffs

#define ffs (   x)    __builtin_ffs(x)

◆ for_each_clear_bit

#define for_each_clear_bit (   bit,
  addr,
  size 
)
Value:
for ((bit) = find_first_zero_bit((addr), (size)); \
(bit) < (size); \
(bit) = find_next_zero_bit((addr), (size), (bit) + 1))
size_t size
Definition drm_bridge.h:1299

◆ for_each_set_bit

#define for_each_set_bit (   bit,
  addr,
  size 
)
Value:
for ((bit) = find_first_bit((addr), (size)); \
(bit) < (size); \
(bit) = find_next_bit((addr), (size), (bit) + 1))

◆ for_each_set_bit_from

#define for_each_set_bit_from (   bit,
  addr,
  size 
)
Value:
for (; (bit) = find_next_bit((addr), (size), (bit)), \
(bit) < (size); (bit)++)

◆ hweight32

#define hweight32 (   w)    __builtin_popcount(w)

◆ hweight64

#define hweight64 (   w)    __builtin_popcountll(w)

◆ IS_ALIGNED

#define IS_ALIGNED (   x,
  a 
)    (((x) & ((typeof(x))(a) - 1)) == 0)

◆ le32_to_cpup

#define le32_to_cpup   __le32_to_cpup

◆ set_bit

#define set_bit (   nr,
  addr 
)
Value:
(((unsigned long*)(addr))[(nr) / BITS_PER_LONG] |= \
(1UL << ((nr) % BITS_PER_LONG)))

◆ test_bit

#define test_bit (   nr,
  addr 
)
Value:
(((unsigned long*)(addr))[(nr) / BITS_PER_LONG] & \
(1UL << ((nr) % BITS_PER_LONG)))