Preprocessor macros for global use. More...
#include <fcntl.h>#include <sys/stat.h>

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) |
Preprocessor macros for global use.
Definition in file preproc.h.
| #define _BITCOUNT1 | ( | x | ) | (_BITCOUNTx(_BITCOUNT2(x), 0x00000000ffffffffULL, 32)) |
| #define _BITCOUNT2 | ( | x | ) | (_BITCOUNTx(_BITCOUNT3(x), 0x0000ffff0000ffffULL, 16)) |
| #define _BITCOUNT3 | ( | x | ) | (_BITCOUNTx(_BITCOUNT4(x), 0x00ff00ff00ff00ffULL, 8)) |
| #define _BITCOUNT4 | ( | x | ) | (_BITCOUNTx(_BITCOUNT5(x), 0x0f0f0f0f0f0f0f0fULL, 4)) |
| #define _BITCOUNT5 | ( | x | ) | (_BITCOUNTx(_BITCOUNT6(x), 0x3333333333333333ULL, 2)) |
| #define _BITCOUNT6 | ( | x | ) | (_BITCOUNTx( (x), 0x5555555555555555ULL, 1)) |
| #define _BITCOUNTx | ( | x, | |||
| m, | |||||
| s | ) | ( ((x) & m) + (((x) & (m << s)) >> s) ) |
| #define MODE_T_SHIFT_BITS (_BITCOUNT(S_IFMT ^ (S_IFMT-1)) -1) |
| #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)) |
| #define PACKED_to_MODE_T | ( | p | ) | ((p) << MODE_T_SHIFT_BITS) |
Definition at line 46 of file preproc.h.
Referenced by cb__add_entry(), DEBUGP_dump_estat(), df___diff_wc_remote(), sync__progress(), up__handle_special(), up__parse_prop(), up__set_meta_data(), and waa__update_tree().
| #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().
1.6.1