CUBRID Engine  latest
bit.c File Reference
#include "bit.h"
#include <assert.h>
Include dependency graph for bit.c:

Go to the source code of this file.

Macros

#define BYTE_ONES_2(n)   (n), (n) + 1, (n) + 1, (n) + 2
 
#define BYTE_ONES_4(n)   BYTE_ONES_2(n), BYTE_ONES_2((n) + 1), BYTE_ONES_2((n) + 1), BYTE_ONES_2((n) + 2)
 
#define BYTE_ONES_6(n)   BYTE_ONES_4(n), BYTE_ONES_4((n) + 1), BYTE_ONES_4((n) + 1), BYTE_ONES_4((n) + 2)
 
#define BYTE_ONES_8(n)   BYTE_ONES_6(n), BYTE_ONES_6((n) + 1), BYTE_ONES_6((n) + 1), BYTE_ONES_6((n) + 2)
 
#define BYTE_ZEROS_2(n)   8 - (n), 8 - (n) - 1, 8 - (n) - 1, 8 - (n) - 2
 
#define BYTE_ZEROS_4(n)   BYTE_ZEROS_2(n), BYTE_ZEROS_2((n) + 1), BYTE_ZEROS_2((n) + 1), BYTE_ZEROS_2((n) + 2)
 
#define BYTE_ZEROS_6(n)   BYTE_ZEROS_4(n), BYTE_ZEROS_4((n) + 1), BYTE_ZEROS_4((n) + 1), BYTE_ZEROS_4((n) + 2)
 
#define BYTE_ZEROS_8(n)   BYTE_ZEROS_6(n), BYTE_ZEROS_6((n) + 1), BYTE_ZEROS_6((n) + 1), BYTE_ZEROS_6((n) + 2)
 

Functions

int bit8_count_ones (UINT8 i)
 
int bit8_count_zeros (UINT8 i)
 
int bit8_count_trailing_zeros (UINT8 i)
 
int bit8_count_trailing_ones (UINT8 i)
 
int bit8_count_leading_zeros (UINT8 i)
 
int bit8_count_leading_ones (UINT8 i)
 
bool bit8_is_set (UINT8 i, int off)
 
UINT8 bit8_set (UINT8 i, int off)
 
UINT8 bit8_clear (UINT8 i, int off)
 
UINT8 bit8_set_trailing_bits (UINT8 i, int n)
 
int bit16_count_ones (UINT16 i)
 
int bit16_count_zeros (UINT16 i)
 
int bit16_count_trailing_zeros (UINT16 i)
 
int bit16_count_trailing_ones (UINT16 i)
 
int bit16_count_leading_zeros (UINT16 i)
 
int bit16_count_leading_ones (UINT16 i)
 
bool bit16_is_set (UINT16 i, int off)
 
UINT16 bit16_set (UINT16 i, int off)
 
UINT16 bit16_clear (UINT16 i, int off)
 
UINT16 bit16_set_trailing_bits (UINT16 i, int n)
 
int bit32_count_ones (UINT32 i)
 
int bit32_count_zeros (UINT32 i)
 
int bit32_count_trailing_zeros (UINT32 i)
 
int bit32_count_trailing_ones (UINT32 i)
 
int bit32_count_leading_zeros (UINT32 i)
 
int bit32_count_leading_ones (UINT32 i)
 
bool bit32_is_set (UINT32 i, int off)
 
UINT32 bit32_set (UINT32 i, int off)
 
UINT32 bit32_clear (UINT32 i, int off)
 
UINT32 bit32_set_trailing_bits (UINT32 i, int n)
 
int bit64_count_ones (UINT64 i)
 
int bit64_count_zeros (UINT64 i)
 
int bit64_count_trailing_zeros (UINT64 i)
 
int bit64_count_trailing_ones (UINT64 i)
 
int bit64_count_leading_zeros (UINT64 i)
 
int bit64_count_leading_ones (UINT64 i)
 
bool bit64_is_set (UINT64 i, int off)
 
UINT64 bit64_set (UINT64 i, int off)
 
UINT64 bit64_clear (UINT64 i, int off)
 
UINT64 bit64_set_trailing_bits (UINT64 i, int n)
 

Variables

static const int byte_ones [256]
 
static const int byte_zeros [256]
 

Macro Definition Documentation

#define BYTE_ONES_2 (   n)    (n), (n) + 1, (n) + 1, (n) + 2

Definition at line 34 of file bit.c.

#define BYTE_ONES_4 (   n)    BYTE_ONES_2(n), BYTE_ONES_2((n) + 1), BYTE_ONES_2((n) + 1), BYTE_ONES_2((n) + 2)

Definition at line 35 of file bit.c.

#define BYTE_ONES_6 (   n)    BYTE_ONES_4(n), BYTE_ONES_4((n) + 1), BYTE_ONES_4((n) + 1), BYTE_ONES_4((n) + 2)

Definition at line 36 of file bit.c.

#define BYTE_ONES_8 (   n)    BYTE_ONES_6(n), BYTE_ONES_6((n) + 1), BYTE_ONES_6((n) + 1), BYTE_ONES_6((n) + 2)

Definition at line 37 of file bit.c.

#define BYTE_ZEROS_2 (   n)    8 - (n), 8 - (n) - 1, 8 - (n) - 1, 8 - (n) - 2

Definition at line 42 of file bit.c.

#define BYTE_ZEROS_4 (   n)    BYTE_ZEROS_2(n), BYTE_ZEROS_2((n) + 1), BYTE_ZEROS_2((n) + 1), BYTE_ZEROS_2((n) + 2)

Definition at line 43 of file bit.c.

#define BYTE_ZEROS_6 (   n)    BYTE_ZEROS_4(n), BYTE_ZEROS_4((n) + 1), BYTE_ZEROS_4((n) + 1), BYTE_ZEROS_4((n) + 2)

Definition at line 44 of file bit.c.

#define BYTE_ZEROS_8 (   n)    BYTE_ZEROS_6(n), BYTE_ZEROS_6((n) + 1), BYTE_ZEROS_6((n) + 1), BYTE_ZEROS_6((n) + 2)

Definition at line 45 of file bit.c.

Function Documentation

UINT16 bit16_clear ( UINT16  i,
int  off 
)

Definition at line 284 of file bit.c.

References assert, and i.

int bit16_count_leading_ones ( UINT16  i)

Definition at line 263 of file bit.c.

References bit16_count_leading_zeros().

int bit16_count_leading_zeros ( UINT16  i)

Definition at line 226 of file bit.c.

Referenced by bit16_count_leading_ones().

Here is the caller graph for this function:

int bit16_count_ones ( UINT16  i)

Definition at line 173 of file bit.c.

References byte_ones.

Referenced by main().

Here is the caller graph for this function:

int bit16_count_trailing_ones ( UINT16  i)

Definition at line 220 of file bit.c.

References bit16_count_trailing_zeros().

Referenced by main().

Here is the caller graph for this function:

int bit16_count_trailing_zeros ( UINT16  i)

Definition at line 187 of file bit.c.

References i.

Referenced by bit16_count_trailing_ones(), and main().

Here is the caller graph for this function:

int bit16_count_zeros ( UINT16  i)

Definition at line 180 of file bit.c.

References byte_zeros.

Referenced by main().

Here is the caller graph for this function:

bool bit16_is_set ( UINT16  i,
int  off 
)

Definition at line 269 of file bit.c.

References assert.

UINT16 bit16_set ( UINT16  i,
int  off 
)

Definition at line 276 of file bit.c.

References assert, and i.

UINT16 bit16_set_trailing_bits ( UINT16  i,
int  n 
)

Definition at line 292 of file bit.c.

References assert.

UINT32 bit32_clear ( UINT32  i,
int  off 
)

Definition at line 431 of file bit.c.

References assert, and i.

int bit32_count_leading_ones ( UINT32  i)

Definition at line 410 of file bit.c.

References bit32_count_leading_zeros().

int bit32_count_leading_zeros ( UINT32  i)

Definition at line 368 of file bit.c.

Referenced by bit32_count_leading_ones().

Here is the caller graph for this function:

int bit32_count_ones ( UINT32  i)

Definition at line 304 of file bit.c.

Referenced by bit32_count_zeros(), and main().

Here is the caller graph for this function:

int bit32_count_trailing_ones ( UINT32  i)

Definition at line 362 of file bit.c.

References bit32_count_trailing_zeros().

Referenced by main().

Here is the caller graph for this function:

int bit32_count_trailing_zeros ( UINT32  i)

Definition at line 319 of file bit.c.

References i.

Referenced by bit32_count_trailing_ones(), and main().

Here is the caller graph for this function:

int bit32_count_zeros ( UINT32  i)

Definition at line 313 of file bit.c.

References bit32_count_ones().

Referenced by main().

Here is the caller graph for this function:

bool bit32_is_set ( UINT32  i,
int  off 
)

Definition at line 416 of file bit.c.

References assert.

UINT32 bit32_set ( UINT32  i,
int  off 
)

Definition at line 423 of file bit.c.

References assert, and i.

UINT32 bit32_set_trailing_bits ( UINT32  i,
int  n 
)

Definition at line 439 of file bit.c.

References assert.

UINT64 bit64_clear ( UINT64  i,
int  off 
)

Definition at line 587 of file bit.c.

References assert, and i.

Referenced by disk_check(), disk_stab_cursor_clear_bit(), and file_partsect_clear_bit().

Here is the caller graph for this function:

int bit64_count_leading_ones ( UINT64  i)

Definition at line 566 of file bit.c.

References bit64_count_leading_zeros().

int bit64_count_leading_zeros ( UINT64  i)

Definition at line 519 of file bit.c.

Referenced by bit64_count_leading_ones().

Here is the caller graph for this function:

int bit64_count_ones ( UINT64  i)

Definition at line 451 of file bit.c.

Referenced by bit64_count_zeros(), disk_rv_reserve_sectors(), disk_rv_unreserve_sectors(), and main().

Here is the caller graph for this function:

int bit64_count_trailing_ones ( UINT64  i)

Definition at line 513 of file bit.c.

References bit64_count_trailing_zeros().

Referenced by disk_stab_unit_reserve(), file_partsect_alloc(), and main().

Here is the caller graph for this function:

int bit64_count_trailing_zeros ( UINT64  i)

Definition at line 466 of file bit.c.

References i.

Referenced by bit64_count_trailing_ones(), and main().

Here is the caller graph for this function:

int bit64_count_zeros ( UINT64  i)

Definition at line 460 of file bit.c.

References bit64_count_ones().

Referenced by disk_stab_count_free(), and main().

Here is the caller graph for this function:

bool bit64_is_set ( UINT64  i,
int  off 
)

Definition at line 572 of file bit.c.

References assert.

Referenced by disk_check(), disk_stab_cursor_is_bit_set(), and file_partsect_is_bit_set().

Here is the caller graph for this function:

UINT64 bit64_set ( UINT64  i,
int  off 
)

Definition at line 579 of file bit.c.

References assert, and i.

Referenced by disk_stab_cursor_set_bit(), disk_stab_unit_check_reserved(), disk_stab_unit_reserve(), disk_stab_unit_unreserve(), and file_partsect_set_bit().

Here is the caller graph for this function:

UINT64 bit64_set_trailing_bits ( UINT64  i,
int  n 
)

Definition at line 595 of file bit.c.

References assert.

Referenced by disk_check(), disk_rv_redo_init_map(), disk_stab_set_bits_contiguous(), and disk_stab_unit_reserve().

Here is the caller graph for this function:

UINT8 bit8_clear ( UINT8  i,
int  off 
)

Definition at line 153 of file bit.c.

References assert, and i.

int bit8_count_leading_ones ( UINT8  i)

Definition at line 132 of file bit.c.

References bit8_count_leading_zeros().

int bit8_count_leading_zeros ( UINT8  i)

Definition at line 100 of file bit.c.

Referenced by bit8_count_leading_ones().

Here is the caller graph for this function:

int bit8_count_ones ( UINT8  i)

Definition at line 51 of file bit.c.

References byte_ones, and i.

Referenced by main().

Here is the caller graph for this function:

int bit8_count_trailing_ones ( UINT8  i)

Definition at line 94 of file bit.c.

References bit8_count_trailing_zeros().

Referenced by main().

Here is the caller graph for this function:

int bit8_count_trailing_zeros ( UINT8  i)

Definition at line 65 of file bit.c.

References i.

Referenced by bit8_count_trailing_ones(), and main().

Here is the caller graph for this function:

int bit8_count_zeros ( UINT8  i)

Definition at line 58 of file bit.c.

References byte_zeros, and i.

Referenced by main().

Here is the caller graph for this function:

bool bit8_is_set ( UINT8  i,
int  off 
)

Definition at line 138 of file bit.c.

References assert.

UINT8 bit8_set ( UINT8  i,
int  off 
)

Definition at line 145 of file bit.c.

References assert, and i.

UINT8 bit8_set_trailing_bits ( UINT8  i,
int  n 
)

Definition at line 161 of file bit.c.

References assert.

Variable Documentation

const int byte_ones[256]
static
Initial value:
= {
}
#define BYTE_ONES_8(n)
Definition: bit.c:37

Definition at line 38 of file bit.c.

Referenced by bit16_count_ones(), and bit8_count_ones().

const int byte_zeros[256]
static
Initial value:
= {
}
#define BYTE_ZEROS_8(n)
Definition: bit.c:45

Definition at line 46 of file bit.c.

Referenced by bit16_count_zeros(), and bit8_count_zeros().