Skip to content

Commit 307f923

Browse files
author
David Reveman
committed
build: add radix sort traits for short and unsigned short
1 parent 5491d4a commit 307f923

File tree

1 file changed

+18
-0
lines changed
  • velox/experimental/breeze/breeze/functions

1 file changed

+18
-0
lines changed

velox/experimental/breeze/breeze/functions/sort.h

+18
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,24 @@ struct RadixSortTraits {
3737
static ATTR T from_bit_ordered(T value);
3838
};
3939

40+
// specialization for T=short
41+
template <>
42+
struct RadixSortTraits<short> {
43+
static ATTR short to_bit_ordered(short value) {
44+
return value ^ (1 << utils::Msb<short>::VALUE);
45+
}
46+
static ATTR short from_bit_ordered(short value) {
47+
return value ^ (1 << utils::Msb<short>::VALUE);
48+
}
49+
};
50+
51+
// specialization for T=unsigned short
52+
template <>
53+
struct RadixSortTraits<unsigned short> {
54+
static ATTR unsigned short to_bit_ordered(unsigned short value) { return value; }
55+
static ATTR unsigned short from_bit_ordered(unsigned short value) { return value; }
56+
};
57+
4058
// specialization for T=int
4159
template <>
4260
struct RadixSortTraits<int> {

0 commit comments

Comments
 (0)