mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-17 11:52:27 +00:00
Added SIMD for UInt32/64
This commit is contained in:
parent
2b8592cd5b
commit
539555b755
@ -14,6 +14,9 @@
|
||||
#include <cstdint>
|
||||
#include <numeric>
|
||||
|
||||
#include <libdivide-config.h>
|
||||
#include <libdivide.h>
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
@ -26,10 +29,6 @@ T gcd_func(T a, T b)
|
||||
a = b;
|
||||
b = c;
|
||||
}
|
||||
if (a == T(-1))
|
||||
{
|
||||
return -a;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
@ -116,12 +115,26 @@ void compressDataForType(const char * source, UInt32 source_size, char * dest)
|
||||
unalignedStore<T>(dest, gcd);
|
||||
dest += sizeof(T);
|
||||
|
||||
cur_source = source;
|
||||
while (cur_source < source_end)
|
||||
if (sizeof(T) == 4 || sizeof(T) == 8)
|
||||
{
|
||||
unalignedStore<T>(dest, unalignedLoad<T>(cur_source) / gcd);
|
||||
cur_source += sizeof(T);
|
||||
dest += sizeof(T);
|
||||
libdivide::divider<T> divider(gcd);
|
||||
cur_source = source;
|
||||
while (cur_source < source_end)
|
||||
{
|
||||
unalignedStore<T>(dest, unalignedLoad<T>(cur_source) / divider);
|
||||
cur_source += sizeof(T);
|
||||
dest += sizeof(T);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cur_source = source;
|
||||
while (cur_source < source_end)
|
||||
{
|
||||
unalignedStore<T>(dest, unalignedLoad<T>(cur_source) / gcd);
|
||||
cur_source += sizeof(T);
|
||||
dest += sizeof(T);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user