4 ms·
The big table becomes more obvious when the constants are written using hex: static uint64_t table[] = { 0x100000000, 0x1FFFFFFF6, 0x1FFFFFFF6, 0x1FF
by silvestrov 5y ago
The big table becomes more obvious when the constants are written using hex:
static uint64_t table[] = {
0x100000000, 0x1FFFFFFF6, 0x1FFFFFFF6,
0x1FFFFFFF6, 0x2FFFFFF9C, 0x2FFFFFF9C,
0x2FFFFFF9C, 0x3FFFFFC18, 0x3FFFFFC18,
0x3FFFFFC18, 0x4FFFFD8F0, 0x4FFFFD8F0,
0x4FFFFD8F0, 0x4FFFFD8F0, 0x5FFFE7960,
0x5FFFE7960, 0x5FFFE7960, 0x6FFF0BDC0,
0x6FFF0BDC0, 0x6FFF0BDC0, 0x7FF676980,
0x7FF676980, 0x7FF676980, 0x7FF676980,
0x8FA0A1F00, 0x8FA0A1F00, 0x8FA0A1F00,
0x9C4653600, 0x9C4653600, 0x9C4653600,
0xA00000000, 0xA00000000,
};
- kwillets 5y agoOriginally I used a macro: // this increments the upper 32 bits (log10 T - 1) when >= T is added #define K(T) (((sizeof(#T)-1)<<32) - T) (T is 10,100, etc.)