OpenNSL API Guide and Reference Manual
Macros | Functions
bitop.h File Reference
#include <sal/types.h>

Go to the source code of this file.

Macros

#define _SHR_BITDCLSIZE(_max)   (((_max) + SHR_BITWID - 1) / SHR_BITWID)
 
#define _SHR_BITDCLSIZE_FROM_START_BIT(_start_bit, _range)   (_range + _start_bit -1)/SHR_BITWID - _start_bit/SHR_BITWID + 1
 
#define _SHR_BITOP(_a, _b, _op)   (((_a)[(_b) / SHR_BITWID]) _op (1U << ((_b) % SHR_BITWID)))
 
#define SHR_BIT_DCL_CLR_NAME(_n, _max)   SHR_BITDCL _n[_SHR_BITDCLSIZE(_max)] = {0}
 
#define SHR_BIT_ITER(_a, _max, _b)
 
#define SHR_BITALLOCSIZE(_max)   (_SHR_BITDCLSIZE(_max) * sizeof (SHR_BITDCL))
 
#define SHR_BITALLOCSIZE_FROM_START_BIT(_start_bit, _range)   (_SHR_BITDCLSIZE_FROM_START_BIT(_start_bit, _range) * sizeof (SHR_BITDCL))
 
#define SHR_BITAND_RANGE(_bits1, _bits2, _first, _bit_count, _dest)   (shr_bitop_range_and(_bits1, _bits2, _first, _bit_count, _dest))
 
#define SHR_BITCLR(_a, _b)   _SHR_BITOP(_a, _b, &= ~)
 
#define SHR_BITCLR_RANGE(_a, _b, _c)   (shr_bitop_range_clear(_a, _b, _c))
 
#define SHR_BITCOPY_RANGE(_dest, _dest_offset, _src, _src_offset, _num_bits)   (shr_bitop_range_copy(_dest, _dest_offset, _src, _src_offset, _num_bits))
 
#define SHR_BITCOUNT_RANGE(_bits, _count, _first, _range)   shr_bitop_range_count(_bits, _first, _range, &(_count))
 
#define SHR_BITDCL   uint32
 
#define SHR_BITDCLNAME(_n, _max)   SHR_BITDCL _n[_SHR_BITDCLSIZE(_max)]
 
#define SHR_BITEQ_RANGE(_bits1, _bits2, _first, _range)   (shr_bitop_range_eq(_bits1, _bits2, _first, _range))
 
#define SHR_BITGET(_a, _b)   _SHR_BITOP(_a, _b, &)
 
#define SHR_BITNEGATE_RANGE(_bits1, _first, _bit_count, _dest)   (shr_bitop_range_negate(_bits1, _first, _bit_count, _dest))
 
#define SHR_BITNULL_RANGE(_bits, _first, _range)   (shr_bitop_range_null(_bits, _first, _range))
 
#define SHR_BITOR_RANGE(_bits1, _bits2, _first, _bit_count, _dest)   (shr_bitop_range_or(_bits1, _bits2, _first, _bit_count, _dest))
 
#define SHR_BITREMOVE_RANGE(_bits1, _bits2, _first, _bit_count, _dest)   (shr_bitop_range_remove(_bits1, _bits2, _first, _bit_count, _dest))
 
#define SHR_BITSET(_a, _b)   _SHR_BITOP(_a, _b, |=)
 
#define SHR_BITSET_RANGE(_a, _b, _c)   (shr_bitop_range_set(_a, _b, _c))
 
#define SHR_BITTEST_RANGE(_bits, _first, _bit_count, _result)   (_result) = !(shr_bitop_range_null(_bits, _first, _bit_count))
 
#define SHR_BITWID   32
 
#define SHR_BITWRITE(_a, _b, _val)   ((_val) ? SHR_BITSET(_a, _b) : SHR_BITCLR(_a, _b))
 
#define SHR_BITXOR_RANGE(_bits1, _bits2, _first, _bit_count, _dest)   (shr_bitop_range_xor(_bits1, _bits2, _first, _bit_count, _dest))
 

Functions

void shr_bitop_range_and (CONST SHR_BITDCL *bits1, CONST SHR_BITDCL *bits2, CONST int first, CONST int bit_count, SHR_BITDCL *dest)
 
void shr_bitop_range_clear (SHR_BITDCL *a, CONST int b, CONST int c)
 
void shr_bitop_range_copy (SHR_BITDCL *a, CONST int b, CONST SHR_BITDCL *c, CONST int d, CONST int e)
 
void shr_bitop_range_count (CONST SHR_BITDCL *bits, CONST int first, CONST int range, int *count)
 
int shr_bitop_range_eq (CONST SHR_BITDCL *bits1, CONST SHR_BITDCL *bits2, CONST int first, CONST int range)
 
void shr_bitop_range_negate (CONST SHR_BITDCL *bits1, CONST int first, CONST int bit_count, SHR_BITDCL *dest)
 
int shr_bitop_range_null (CONST SHR_BITDCL *a, CONST int first, CONST int bit_count)
 
void shr_bitop_range_or (CONST SHR_BITDCL *bits1, CONST SHR_BITDCL *bits2, CONST int first, CONST int bit_count, SHR_BITDCL *dest)
 
void shr_bitop_range_remove (CONST SHR_BITDCL *bits1, CONST SHR_BITDCL *bits2, CONST int first, CONST int bit_count, SHR_BITDCL *dest)
 
void shr_bitop_range_set (SHR_BITDCL *a, CONST int b, CONST int c)
 
void shr_bitop_range_xor (CONST SHR_BITDCL *bits1, CONST SHR_BITDCL *bits2, CONST int first, CONST int bit_count, SHR_BITDCL *dest)
 

Macro Definition Documentation

#define _SHR_BITDCLSIZE (   _max)    (((_max) + SHR_BITWID - 1) / SHR_BITWID)

Definition at line 32 of file bitop.h.

#define _SHR_BITDCLSIZE_FROM_START_BIT (   _start_bit,
  _range 
)    (_range + _start_bit -1)/SHR_BITWID - _start_bit/SHR_BITWID + 1

Definition at line 39 of file bitop.h.

#define _SHR_BITOP (   _a,
  _b,
  _op 
)    (((_a)[(_b) / SHR_BITWID]) _op (1U << ((_b) % SHR_BITWID)))

Definition at line 54 of file bitop.h.

#define SHR_BIT_DCL_CLR_NAME (   _n,
  _max 
)    SHR_BITDCL _n[_SHR_BITDCLSIZE(_max)] = {0}

Definition at line 50 of file bitop.h.

#define SHR_BIT_ITER (   _a,
  _max,
  _b 
)
Value:
for ((_b) = 0; (_b) < (_max); (_b)++) \
if ((_a)[(_b) / SHR_BITWID] == 0) \
(_b) += (SHR_BITWID - 1); \
else if (SHR_BITGET((_a), (_b)))

Definition at line 62 of file bitop.h.

#define SHR_BITALLOCSIZE (   _max)    (_SHR_BITDCLSIZE(_max) * sizeof (SHR_BITDCL))

Definition at line 35 of file bitop.h.

#define SHR_BITALLOCSIZE_FROM_START_BIT (   _start_bit,
  _range 
)    (_SHR_BITDCLSIZE_FROM_START_BIT(_start_bit, _range) * sizeof (SHR_BITDCL))

Definition at line 43 of file bitop.h.

#define SHR_BITAND_RANGE (   _bits1,
  _bits2,
  _first,
  _bit_count,
  _dest 
)    (shr_bitop_range_and(_bits1, _bits2, _first, _bit_count, _dest))

Definition at line 117 of file bitop.h.

#define SHR_BITCLR (   _a,
  _b 
)    _SHR_BITOP(_a, _b, &= ~)

Definition at line 60 of file bitop.h.

#define SHR_BITCLR_RANGE (   _a,
  _b,
  _c 
)    (shr_bitop_range_clear(_a, _b, _c))

Definition at line 71 of file bitop.h.

#define SHR_BITCOPY_RANGE (   _dest,
  _dest_offset,
  _src,
  _src_offset,
  _num_bits 
)    (shr_bitop_range_copy(_dest, _dest_offset, _src, _src_offset, _num_bits))

Definition at line 89 of file bitop.h.

#define SHR_BITCOUNT_RANGE (   _bits,
  _count,
  _first,
  _range 
)    shr_bitop_range_count(_bits, _first, _range, &(_count))

Definition at line 146 of file bitop.h.

#define SHR_BITDCL   uint32

Definition at line 28 of file bitop.h.

#define SHR_BITDCLNAME (   _n,
  _max 
)    SHR_BITDCL _n[_SHR_BITDCLSIZE(_max)]

Definition at line 48 of file bitop.h.

#define SHR_BITEQ_RANGE (   _bits1,
  _bits2,
  _first,
  _range 
)    (shr_bitop_range_eq(_bits1, _bits2, _first, _range))

Definition at line 144 of file bitop.h.

#define SHR_BITGET (   _a,
  _b 
)    _SHR_BITOP(_a, _b, &)

Definition at line 58 of file bitop.h.

#define SHR_BITNEGATE_RANGE (   _bits1,
  _first,
  _bit_count,
  _dest 
)    (shr_bitop_range_negate(_bits1, _first, _bit_count, _dest))

Definition at line 134 of file bitop.h.

#define SHR_BITNULL_RANGE (   _bits,
  _first,
  _range 
)    (shr_bitop_range_null(_bits, _first, _range))

Definition at line 142 of file bitop.h.

#define SHR_BITOR_RANGE (   _bits1,
  _bits2,
  _first,
  _bit_count,
  _dest 
)    (shr_bitop_range_or(_bits1, _bits2, _first, _bit_count, _dest))

Definition at line 120 of file bitop.h.

#define SHR_BITREMOVE_RANGE (   _bits1,
  _bits2,
  _first,
  _bit_count,
  _dest 
)    (shr_bitop_range_remove(_bits1, _bits2, _first, _bit_count, _dest))

Definition at line 126 of file bitop.h.

#define SHR_BITSET (   _a,
  _b 
)    _SHR_BITOP(_a, _b, |=)

Definition at line 59 of file bitop.h.

#define SHR_BITSET_RANGE (   _a,
  _b,
  _c 
)    (shr_bitop_range_set(_a, _b, _c))

Definition at line 76 of file bitop.h.

#define SHR_BITTEST_RANGE (   _bits,
  _first,
  _bit_count,
  _result 
)    (_result) = !(shr_bitop_range_null(_bits, _first, _bit_count))

Definition at line 93 of file bitop.h.

#define SHR_BITWID   32

Definition at line 29 of file bitop.h.

#define SHR_BITWRITE (   _a,
  _b,
  _val 
)    ((_val) ? SHR_BITSET(_a, _b) : SHR_BITCLR(_a, _b))

Definition at line 61 of file bitop.h.

#define SHR_BITXOR_RANGE (   _bits1,
  _bits2,
  _first,
  _bit_count,
  _dest 
)    (shr_bitop_range_xor(_bits1, _bits2, _first, _bit_count, _dest))

Definition at line 123 of file bitop.h.

Function Documentation

void shr_bitop_range_and ( CONST SHR_BITDCL bits1,
CONST SHR_BITDCL bits2,
CONST int  first,
CONST int  bit_count,
SHR_BITDCL dest 
)
void shr_bitop_range_clear ( SHR_BITDCL a,
CONST int  b,
CONST int  c 
)
void shr_bitop_range_copy ( SHR_BITDCL a,
CONST int  b,
CONST SHR_BITDCL c,
CONST int  d,
CONST int  e 
)
void shr_bitop_range_count ( CONST SHR_BITDCL bits,
CONST int  first,
CONST int  range,
int *  count 
)
int shr_bitop_range_eq ( CONST SHR_BITDCL bits1,
CONST SHR_BITDCL bits2,
CONST int  first,
CONST int  range 
)
void shr_bitop_range_negate ( CONST SHR_BITDCL bits1,
CONST int  first,
CONST int  bit_count,
SHR_BITDCL dest 
)
int shr_bitop_range_null ( CONST SHR_BITDCL a,
CONST int  first,
CONST int  bit_count 
)
void shr_bitop_range_or ( CONST SHR_BITDCL bits1,
CONST SHR_BITDCL bits2,
CONST int  first,
CONST int  bit_count,
SHR_BITDCL dest 
)
void shr_bitop_range_remove ( CONST SHR_BITDCL bits1,
CONST SHR_BITDCL bits2,
CONST int  first,
CONST int  bit_count,
SHR_BITDCL dest 
)
void shr_bitop_range_set ( SHR_BITDCL a,
CONST int  b,
CONST int  c 
)
void shr_bitop_range_xor ( CONST SHR_BITDCL bits1,
CONST SHR_BITDCL bits2,
CONST int  first,
CONST int  bit_count,
SHR_BITDCL dest 
)