Skip to content

Commit 0ae57ef

Browse files
fixes for c++20 (#147)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 7aa998c commit 0ae57ef

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

sysrap/scuda.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,19 @@ SUTIL_INLINE SUTIL_HOSTDEVICE unsigned long long min(unsigned long long a, unsig
101101
return a < b ? a : b;
102102
}
103103

104+
// Avoid conflict with C++20 std::lerp (and <math.h> bringing it into global)
105+
106+
#if defined(__cpp_lib_interpolate) // && !defined(__CUDA_ARCH__)
107+
using std::lerp; // make std::lerp visible to unqualified calls
108+
#else
104109

105110
/** lerp */
106111
SUTIL_INLINE SUTIL_HOSTDEVICE float lerp(const float a, const float b, const float t)
107112
{
108113
return a + t*(b-a);
109114
}
110115

111-
112-
116+
#endif
113117

114118
/** bilerp */
115119
SUTIL_INLINE SUTIL_HOSTDEVICE float bilerp(const float x00, const float x10, const float x01, const float x11,

u4/U4SolidMaker.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,7 +2138,7 @@ const G4VSolid* U4SolidMaker::BltLocalFastenerAcrylicConstruction(const char* na
21382138
{
21392139
[[maybe_unused]] const char* PREFIX = "BltLocalFastenerAcrylicConstruction" ;
21402140
assert( sstr::StartsWith(name,PREFIX ));
2141-
long num_column = sstr::ExtractLong(name, 1) ;
2141+
const size_t num_column = static_cast<size_t>(sstr::ExtractLong(name, 1));
21422142

21432143
LOG(info)
21442144
<< " name " << ( name ? name : "-" )
@@ -2151,8 +2151,10 @@ const G4VSolid* U4SolidMaker::BltLocalFastenerAcrylicConstruction(const char* na
21512151

21522152
G4Tubs* screw = new G4Tubs("screw",0,13*mm,50.*mm,0.0*deg,360.0*deg);
21532153

2154-
G4ThreeVector tlate[num_column] = {} ;
2155-
for(long i=0;i<num_column;i++) tlate[i] = G4ThreeVector(164.*cos(i*pi/4)*mm, 164.*sin(i*pi/4)*mm,-65.0*mm);
2154+
std::vector<G4ThreeVector> tlate(num_column, G4ThreeVector(0, 0, 0));
2155+
2156+
for (long i = 0; i < num_column; i++)
2157+
tlate[i] = G4ThreeVector(164. * cos(i * pi / 4) * mm, 164. * sin(i * pi / 4) * mm, -65.0 * mm);
21562158

21572159
G4VSolid* muni = screw ;
21582160
for(long i=1 ; i < num_column ; i++) muni = new G4UnionSolid( name, muni, screw, 0, tlate[i] ) ;

0 commit comments

Comments
 (0)