In recent refactoring, I can see core format spec are now stored in single data_ element, but the type is size_t, which varies in 32bit/64bit mode.
|
size_t data_ = 1 << fill_size_shift; |
Since it's not storing pointer information and according to the masks, at most 32bit will be used, is it better to change the type to uint32_t?
|
// Data is arranged as follows: |
|
// |
|
// 0 1 2 3 |
|
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
|
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
// |type |align| w | p | s |u|#|L| f | unused | |
|
// +-----+-----+---+---+---+-+-+-+-----+---------------------------+ |
|
// |
|
// w - dynamic width info |
|
// p - dynamic precision info |
|
// s - sign |
|
// u - uppercase (e.g. 'X' for 'x') |
|
// # - alternate form ('#') |
|
// L - localized |
|
// f - fill size |
|
// |
|
// Bitfields are not used because of compiler bugs such as gcc bug 61414. |
|
enum : unsigned { |
|
type_mask = 0x00007, |
|
align_mask = 0x00038, |
|
width_mask = 0x000C0, |
|
precision_mask = 0x00300, |
|
sign_mask = 0x00C00, |
|
uppercase_mask = 0x01000, |
|
alternate_mask = 0x02000, |
|
localized_mask = 0x04000, |
|
fill_size_mask = 0x38000, |
|
|
|
align_shift = 3, |
|
width_shift = 6, |
|
precision_shift = 8, |
|
sign_shift = 10, |
|
fill_size_shift = 15, |
|
|
|
max_fill_size = 4 |
|
}; |
In recent refactoring, I can see core format spec are now stored in single
data_element, but the type issize_t, which varies in 32bit/64bit mode.fmt/include/fmt/base.h
Line 742 in 093b39c
Since it's not storing pointer information and according to the masks, at most 32bit will be used, is it better to change the type to uint32_t?
fmt/include/fmt/base.h
Lines 705 to 740 in 093b39c