preproc.h File Reference

Preprocessor macros for global use. More...

#include <fcntl.h>
#include <sys/stat.h>
Include dependency graph for preproc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define MODE_T_SHIFT_BITS   (_BITCOUNT(S_IFMT ^ (S_IFMT-1)) -1)
 How many bits a mode_t must be shifted to get the packed representation.
#define PACKED_MODE_T_NEEDED_BITS   (_BITCOUNT(S_IFMT))
 The number of bits needed for storage.
#define TEST_PACKED(test, val)   test(PACKED_to_MODE_T(val))
 Simplification for testing packed modes.



#define _BITCOUNTx(x, m, s)   ( ((x) & m) + (((x) & (m << s)) >> s) )
 Macros for counting the bits set.
#define _BITCOUNT6(x)   (_BITCOUNTx( (x), 0x5555555555555555ULL, 1))
#define _BITCOUNT5(x)   (_BITCOUNTx(_BITCOUNT6(x), 0x3333333333333333ULL, 2))
#define _BITCOUNT4(x)   (_BITCOUNTx(_BITCOUNT5(x), 0x0f0f0f0f0f0f0f0fULL, 4))
#define _BITCOUNT3(x)   (_BITCOUNTx(_BITCOUNT4(x), 0x00ff00ff00ff00ffULL, 8))
#define _BITCOUNT2(x)   (_BITCOUNTx(_BITCOUNT3(x), 0x0000ffff0000ffffULL, 16))
#define _BITCOUNT1(x)   (_BITCOUNTx(_BITCOUNT2(x), 0x00000000ffffffffULL, 32))
#define _BITCOUNT(x)   ( (int)_BITCOUNT1(x) )
#define MODE_T_to_PACKED(mode)   ((mode) >> MODE_T_SHIFT_BITS)
 How to convert from mode_t to the packed representation (in struct estat) and back.
#define PACKED_to_MODE_T(p)   ((p) << MODE_T_SHIFT_BITS)

Detailed Description

Preprocessor macros for global use.

Definition in file preproc.h.


Define Documentation

#define _BITCOUNT (  )     ( (int)_BITCOUNT1(x) )

Definition at line 29 of file preproc.h.

#define _BITCOUNT1 (  )     (_BITCOUNTx(_BITCOUNT2(x), 0x00000000ffffffffULL, 32))

Definition at line 28 of file preproc.h.

#define _BITCOUNT2 (  )     (_BITCOUNTx(_BITCOUNT3(x), 0x0000ffff0000ffffULL, 16))

Definition at line 27 of file preproc.h.

#define _BITCOUNT3 (  )     (_BITCOUNTx(_BITCOUNT4(x), 0x00ff00ff00ff00ffULL, 8))

Definition at line 26 of file preproc.h.

#define _BITCOUNT4 (  )     (_BITCOUNTx(_BITCOUNT5(x), 0x0f0f0f0f0f0f0f0fULL, 4))

Definition at line 25 of file preproc.h.

#define _BITCOUNT5 (  )     (_BITCOUNTx(_BITCOUNT6(x), 0x3333333333333333ULL, 2))

Definition at line 24 of file preproc.h.

#define _BITCOUNT6 (  )     (_BITCOUNTx( (x), 0x5555555555555555ULL, 1))

Definition at line 23 of file preproc.h.

#define _BITCOUNTx ( x,
m,
 )     ( ((x) & m) + (((x) & (m << s)) >> s) )

Macros for counting the bits set.

The interested party is referred to "<i>Numerical Recipes</i>".

Definition at line 22 of file preproc.h.

#define MODE_T_SHIFT_BITS   (_BITCOUNT(S_IFMT ^ (S_IFMT-1)) -1)

How many bits a mode_t must be shifted to get the packed representation.

Definition at line 36 of file preproc.h.

#define MODE_T_to_PACKED ( mode   )     ((mode) >> MODE_T_SHIFT_BITS)

How to convert from mode_t to the packed representation (in struct estat) and back.

Definition at line 45 of file preproc.h.

Referenced by cb__add_entry(), dir__enumerator(), ops__load_1entry(), ops__string_to_dev(), ops__update_single_entry(), rev__install_file(), and up__parse_prop().

#define PACKED_MODE_T_NEEDED_BITS   (_BITCOUNT(S_IFMT))

The number of bits needed for storage.

Definition at line 39 of file preproc.h.

#define PACKED_to_MODE_T (  )     ((p) << MODE_T_SHIFT_BITS)
#define TEST_PACKED ( test,
val   )     test(PACKED_to_MODE_T(val))

Simplification for testing packed modes.

Used with S_ISDIR etc.

Definition at line 50 of file preproc.h.

Referenced by rev___undo_change(), up__parse_prop(), waa___finish_directory(), waa___recurse_tree(), and waa__update_tree().


Generated for fsvs by  doxygen 1.6.1