15 #define INSTANTIATE_TYPES(DTYPE, DIM) \
16 using key_t = utility::MiniVec<DTYPE, DIM>; \
17 using hash_t = utility::MiniVecHash<DTYPE, DIM>; \
18 using eq_t = utility::MiniVecEq<DTYPE, DIM>;
20 #define DIM_SWITCHER(DTYPE, DIM, ...) \
22 INSTANTIATE_TYPES(DTYPE, 1) \
23 return __VA_ARGS__(); \
24 } else if (DIM == 2) { \
25 INSTANTIATE_TYPES(DTYPE, 2) \
26 return __VA_ARGS__(); \
27 } else if (DIM == 3) { \
28 INSTANTIATE_TYPES(DTYPE, 3) \
29 return __VA_ARGS__(); \
30 } else if (DIM == 4) { \
31 INSTANTIATE_TYPES(DTYPE, 4) \
32 return __VA_ARGS__(); \
33 } else if (DIM == 5) { \
34 INSTANTIATE_TYPES(DTYPE, 5) \
35 return __VA_ARGS__(); \
36 } else if (DIM == 6) { \
37 INSTANTIATE_TYPES(DTYPE, 6) \
38 return __VA_ARGS__(); \
41 "Unsupported dim {}, please modify {} and compile from " \
47 #define DISPATCH_DTYPE_AND_DIM_TO_TEMPLATE(DTYPE, DIM, ...) \
49 if (DTYPE == cloudViewer::core::Int64) { \
50 DIM_SWITCHER(int64_t, DIM, __VA_ARGS__) \
51 } else if (DTYPE == cloudViewer::core::Int32) { \
52 DIM_SWITCHER(int, DIM, __VA_ARGS__) \
53 } else if (DTYPE == cloudViewer::core::Int16) { \
54 DIM_SWITCHER(short, DIM, __VA_ARGS__) \
57 "Unsupported dtype {}, please use integer types (Int64, " \
67 #define DISPATCH_DIVISOR_SIZE_TO_BLOCK_T(DIVISOR, ...) \
69 if (DIVISOR == 16) { \
70 using block_t = int4; \
71 return __VA_ARGS__(); \
72 } else if (DIVISOR == 12) { \
73 using block_t = int3; \
74 return __VA_ARGS__(); \
75 } else if (DIVISOR == 8) { \
76 using block_t = int2; \
77 return __VA_ARGS__(); \
78 } else if (DIVISOR == 4) { \
79 using block_t = int; \
80 return __VA_ARGS__(); \
81 } else if (DIVISOR == 2) { \
82 using block_t = int16_t; \
83 return __VA_ARGS__(); \
85 using block_t = uint8_t; \
86 return __VA_ARGS__(); \
94 template <
typename T,
int N>
99 uint64_t hash = UINT64_C(14695981039346656037);
100 #if defined(__CUDA_ARCH__)
103 for (
int i = 0; i < N; ++i) {
104 hash ^=
static_cast<uint64_t
>(key[i]);
105 hash *= UINT64_C(1099511628211);
111 template <
typename T,
int N>
116 bool is_equal =
true;
117 #if defined(__CUDA_ARCH__)
120 for (
int i = 0; i < N; ++i) {
121 is_equal = is_equal && (lhs[i] == rhs[i]);
#define CLOUDVIEWER_HOST_DEVICE
Generic file read and write utility for python interface.
CLOUDVIEWER_HOST_DEVICE bool operator()(const MiniVec< T, N > &lhs, const MiniVec< T, N > &rhs) const
CLOUDVIEWER_HOST_DEVICE uint64_t operator()(const MiniVec< T, N > &key) const