Skip to content

Commit

Permalink
Merge pull request #218 from manopapad/old-style-cast
Browse files Browse the repository at this point in the history
Remove old-style casts
  • Loading branch information
manopapad authored Mar 15, 2022
2 parents bc7ba6e + 768460c commit cf01497
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/cunumeric/arg.inl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ __CUDA_HD__ inline void Argval<T>::apply(const Argval<T>& rhs)
// Spin until no one else is doing their comparison
// We use -1 as a guard to indicate we're doing our
// comparison since we know all indexes should be >= 0
volatile long long* ptr = (volatile long long*)&arg;
volatile long long* ptr = reinterpret_cast<volatile long long*>(&arg);
long long next = *ptr;
long long current;
do {
Expand Down
2 changes: 1 addition & 1 deletion src/cunumeric/divmod.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ struct FastDivmod {
// Use IMUL.HI if div != 1, else simply copy the source.
quo = (div != 1) ? __umulhi(src, mul) >> shr : src;
#else
quo = int((div != 1) ? int(((int64_t)src * mul) >> 32) >> shr : src);
quo = (div != 1) ? static_cast<int>((int64_t{src} * mul) >> 32) >> shr : src;
#endif
// The remainder.
rem = src - (quo * div);
Expand Down
6 changes: 3 additions & 3 deletions src/cunumeric/random/philox.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ class Philox_2x32 {
prod_hi = __umulhi(ctr_lo, PHILOX_M2x32_0x);
prod_lo = ctr_lo * PHILOX_M2x32_0x;
#else
u64 prod = ((u64)ctr_lo) * PHILOX_M2x32_0x;
u64 prod = u64{ctr_lo} * PHILOX_M2x32_0x;
prod_hi = prod >> 32;
prod_lo = prod;
#endif
ctr_lo = ctr_hi ^ key ^ prod_hi;
ctr_hi = prod_lo;
key += PHILOX_W32_0x;
}
return (((u64)ctr_hi) << 32) + ctr_lo;
return (u64{ctr_hi} << 32) + ctr_lo;
}

// Helper function for CPU hi 64-bit multiplication
Expand Down Expand Up @@ -90,7 +90,7 @@ class Philox_2x32 {
#ifdef __NVCC__
return __umulhi(bits, n);
#else
return (((u64)bits) * ((u64)bits)) >> 32;
return (u64{bits} * u64{bits}) >> 32;
#endif
}

Expand Down
4 changes: 2 additions & 2 deletions src/cunumeric/random/rand_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
#include "cunumeric/cunumeric.h"
#include "cunumeric/random/philox.h"

#define HI_BITS(x) ((unsigned)((x) >> 32))
#define LO_BITS(x) ((unsigned)((x)&0x00000000FFFFFFFF))
#define HI_BITS(x) (static_cast<unsigned>((x) >> 32))
#define LO_BITS(x) (static_cast<unsigned>((x)&0x00000000FFFFFFFF))

namespace cunumeric {

Expand Down

0 comments on commit cf01497

Please sign in to comment.