refactory hex/unhex/bin/unbin

This commit is contained in:
zxc111 2021-07-02 01:09:44 +08:00
parent 12aea188b0
commit ace487278f
4 changed files with 346 additions and 565 deletions

View File

@ -46,11 +46,6 @@ inline void writeBinByte(UInt8 byte, void * out)
memcpy(out, &bin_byte_to_char_table[static_cast<size_t>(byte) * 8], 8);
}
inline void writeSingleBinByte(UInt8 byte, void * out)
{
memcpy(out, &hex_digit_to_char_uppercase_table[static_cast<size_t>(byte)], 1);
}
/// Produces hex representation of an unsigned int with leading zeros (for checksums)
template <typename TUInt>
inline void writeHexUIntImpl(TUInt uint_, char * out, const char * const table)

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
0
1
1010
1111111
@ -11,6 +11,8 @@
0011001100110011001100110011001100110011001100111111001100111111
00000000000011100010011100000111
0000000000000000000011000011110101011101010100111010101000000001
0011000100110010001100110011001100110010001101000011001000110100
0011000100110010001100110011001100110010001101000011001000110100
0
10
测试

View File

@ -11,6 +11,8 @@ select bin(toFloat32(1.2));
select bin(toFloat64(1.2));
select bin(toDecimal32(1.2, 8));
select bin(toDecimal64(1.2, 17));
select bin('12332424');
select bin(toLowCardinality(materialize('12332424')));
select unbin('00110000'); -- 0
select unbin('0011000100110000'); -- 10