Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions sysrap/scuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,19 @@ SUTIL_INLINE SUTIL_HOSTDEVICE unsigned long long min(unsigned long long a, unsig
return a < b ? a : b;
}

// Avoid conflict with C++20 std::lerp (and <math.h> bringing it into global)

#if defined(__cpp_lib_interpolate) // && !defined(__CUDA_ARCH__)
using std::lerp; // make std::lerp visible to unqualified calls
#else

/** lerp */
SUTIL_INLINE SUTIL_HOSTDEVICE float lerp(const float a, const float b, const float t)
{
return a + t*(b-a);
}



#endif

/** bilerp */
SUTIL_INLINE SUTIL_HOSTDEVICE float bilerp(const float x00, const float x10, const float x01, const float x11,
Expand Down
8 changes: 5 additions & 3 deletions u4/U4SolidMaker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2138,7 +2138,7 @@ const G4VSolid* U4SolidMaker::BltLocalFastenerAcrylicConstruction(const char* na
{
[[maybe_unused]] const char* PREFIX = "BltLocalFastenerAcrylicConstruction" ;
assert( sstr::StartsWith(name,PREFIX ));
long num_column = sstr::ExtractLong(name, 1) ;
const size_t num_column = static_cast<size_t>(sstr::ExtractLong(name, 1));
Comment thread
plexoos marked this conversation as resolved.

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

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

G4ThreeVector tlate[num_column] = {} ;
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);
std::vector<G4ThreeVector> tlate(num_column, G4ThreeVector(0, 0, 0));

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);

G4VSolid* muni = screw ;
for(long i=1 ; i < num_column ; i++) muni = new G4UnionSolid( name, muni, screw, 0, tlate[i] ) ;
Comment on lines +2156 to 2160

Copilot AI Sep 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loop variable type mismatch: i is declared as long but num_column is size_t. This can cause signed/unsigned comparison warnings and potential issues on platforms where long and size_t have different sizes. Change the loop variable to size_t i = 0.

Suggested change
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);
G4VSolid* muni = screw ;
for(long i=1 ; i < num_column ; i++) muni = new G4UnionSolid( name, muni, screw, 0, tlate[i] ) ;
for (size_t i = 0; i < num_column; i++)
tlate[i] = G4ThreeVector(164. * cos(i * pi / 4) * mm, 164. * sin(i * pi / 4) * mm, -65.0 * mm);
G4VSolid* muni = screw ;
for(size_t i=1 ; i < num_column ; i++) muni = new G4UnionSolid( name, muni, screw, 0, tlate[i] ) ;

Copilot uses AI. Check for mistakes.
Comment on lines +2156 to 2160

Copilot AI Sep 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loop variable type mismatch: i is declared as long but num_column is size_t. This can cause signed/unsigned comparison warnings and potential issues. Change the loop variable to size_t i = 1.

Suggested change
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);
G4VSolid* muni = screw ;
for(long i=1 ; i < num_column ; i++) muni = new G4UnionSolid( name, muni, screw, 0, tlate[i] ) ;
for (size_t i = 0; i < num_column; i++)
tlate[i] = G4ThreeVector(164. * cos(i * pi / 4) * mm, 164. * sin(i * pi / 4) * mm, -65.0 * mm);
G4VSolid* muni = screw ;
for(size_t i=1 ; i < num_column ; i++) muni = new G4UnionSolid( name, muni, screw, 0, tlate[i] ) ;

Copilot uses AI. Check for mistakes.
Expand Down