Skip to content

Commit ffa2bbb

Browse files
authored
Merge pull request #29 from daniela-hase/dev/clang-build-fix
Fixing compile errors when compiling with clang++
2 parents eb3c9ee + c68a66d commit ffa2bbb

6 files changed

Lines changed: 16 additions & 14 deletions

File tree

cuBQL/builder/cuda/builder_common.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,32 +159,34 @@ namespace cuBQL {
159159
inline __device__ box_t make_box() const;
160160

161161
inline __device__ scalar_t get_lower(int dim) const {
162-
if (box_t::numDims>4)
162+
if constexpr (box_t::numDims>4)
163163
return decode<scalar_t>(lower[dim]);
164-
else if (box_t::numDims==4) {
164+
else if constexpr (box_t::numDims==4) {
165165
return decode<scalar_t>(dim>1
166166
?((dim>2)?lower[3]:lower[2])
167167
:((dim )?lower[1]:lower[0]));
168-
} else if (box_t::numDims==3) {
168+
} else if constexpr (box_t::numDims==3) {
169169
return decode<scalar_t>(dim>1
170170
?lower[2]
171171
:((dim )?lower[1]:lower[0]));
172-
} else
172+
} else {
173173
return decode<scalar_t>(lower[dim]);
174+
}
174175
}
175176
inline __device__ scalar_t get_upper(int dim) const {
176-
if (box_t::numDims>4)
177+
if constexpr (box_t::numDims>4)
177178
return decode<scalar_t>(upper[dim]);
178-
else if (box_t::numDims==4) {
179+
else if constexpr (box_t::numDims==4) {
179180
return decode<scalar_t>(dim>1
180181
?((dim>2)?upper[3]:upper[2])
181182
:((dim )?upper[1]:upper[0]));
182-
} else if (box_t::numDims==3)
183+
} else if constexpr (box_t::numDims==3) {
183184
return decode<scalar_t>(dim>1
184185
?upper[2]
185186
:((dim )?upper[1]:upper[0]));
186-
else
187+
} else {
187188
return decode<scalar_t>(upper[dim]);
189+
}
188190
}
189191

190192
typename int_type_of<scalar_t>::type lower[box_t::numDims];

cuBQL/builder/cuda/elh_builder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ namespace cuBQL {
8585
{
8686
float bestCost = CUBQL_INF;
8787

88-
float rLengths[(int)elh.numBins];
88+
float rLengths[(int)ELHBins<T,D>::numBins];
8989
for (int d=0;d<D;d++) {
9090
box_t<T,D> box; box.set_empty();
9191
int rCount = 0;

cuBQL/builder/cuda/radix.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ namespace cuBQL {
585585
{
586586
const int makeLeafThreshold
587587
= (buildConfig.makeLeafThreshold > 0)
588-
? min(buildConfig.makeLeafThreshold,buildConfig.maxAllowedLeafSize)
588+
? std::min(buildConfig.makeLeafThreshold,buildConfig.maxAllowedLeafSize)
589589
: 1;
590590

591591
// ==================================================================

cuBQL/builder/cuda/rebinMortonBuilder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,7 @@ namespace cuBQL {
11611161
using atomic_box_t = typename ctx_t::atomic_box_t;
11621162
const int makeLeafThreshold
11631163
= (buildConfig.makeLeafThreshold > 0)
1164-
? min(buildConfig.makeLeafThreshold,buildConfig.maxAllowedLeafSize)
1164+
? std::min(buildConfig.makeLeafThreshold,buildConfig.maxAllowedLeafSize)
11651165
: 1;
11661166

11671167
// ==================================================================

cuBQL/builder/cuda/sah_builder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ namespace cuBQL {
6565
{
6666
float bestCost = CUBQL_INF;
6767

68-
float rAreas[sah.numBins];
68+
float rAreas[SAHBins<box_t>::numBins];
6969
for (int d=0;d<3;d++) {
7070
box_t box; box.set_empty();
7171
int rCount = 0;

cuBQL/math/math.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ namespace cuBQL {
3030

3131
#ifdef __CUDA_ARCH__
3232
#else
33-
inline float __int_as_float(int i) { return (const float &)i; }
34-
inline int __float_as_int(float f) { return (const int &)f; }
33+
inline __cubql_both float __int_as_float(int i) { return (const float &)i; }
34+
inline __cubql_both int __float_as_int(float f) { return (const int &)f; }
3535
#endif
3636

3737
inline __cubql_both float squareOf(float f) { return f*f; }

0 commit comments

Comments
 (0)