Skip to content

Commit cf01497

Browse files
authored
Merge pull request #218 from manopapad/old-style-cast
Remove old-style casts
2 parents bc7ba6e + 768460c commit cf01497

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/cunumeric/arg.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ __CUDA_HD__ inline void Argval<T>::apply(const Argval<T>& rhs)
8484
// Spin until no one else is doing their comparison
8585
// We use -1 as a guard to indicate we're doing our
8686
// comparison since we know all indexes should be >= 0
87-
volatile long long* ptr = (volatile long long*)&arg;
87+
volatile long long* ptr = reinterpret_cast<volatile long long*>(&arg);
8888
long long next = *ptr;
8989
long long current;
9090
do {

src/cunumeric/divmod.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ struct FastDivmod {
289289
// Use IMUL.HI if div != 1, else simply copy the source.
290290
quo = (div != 1) ? __umulhi(src, mul) >> shr : src;
291291
#else
292-
quo = int((div != 1) ? int(((int64_t)src * mul) >> 32) >> shr : src);
292+
quo = (div != 1) ? static_cast<int>((int64_t{src} * mul) >> 32) >> shr : src;
293293
#endif
294294
// The remainder.
295295
rem = src - (quo * div);

src/cunumeric/random/philox.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ class Philox_2x32 {
4949
prod_hi = __umulhi(ctr_lo, PHILOX_M2x32_0x);
5050
prod_lo = ctr_lo * PHILOX_M2x32_0x;
5151
#else
52-
u64 prod = ((u64)ctr_lo) * PHILOX_M2x32_0x;
52+
u64 prod = u64{ctr_lo} * PHILOX_M2x32_0x;
5353
prod_hi = prod >> 32;
5454
prod_lo = prod;
5555
#endif
5656
ctr_lo = ctr_hi ^ key ^ prod_hi;
5757
ctr_hi = prod_lo;
5858
key += PHILOX_W32_0x;
5959
}
60-
return (((u64)ctr_hi) << 32) + ctr_lo;
60+
return (u64{ctr_hi} << 32) + ctr_lo;
6161
}
6262

6363
// Helper function for CPU hi 64-bit multiplication
@@ -90,7 +90,7 @@ class Philox_2x32 {
9090
#ifdef __NVCC__
9191
return __umulhi(bits, n);
9292
#else
93-
return (((u64)bits) * ((u64)bits)) >> 32;
93+
return (u64{bits} * u64{bits}) >> 32;
9494
#endif
9595
}
9696

src/cunumeric/random/rand_util.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#include "cunumeric/cunumeric.h"
2020
#include "cunumeric/random/philox.h"
2121

22-
#define HI_BITS(x) ((unsigned)((x) >> 32))
23-
#define LO_BITS(x) ((unsigned)((x)&0x00000000FFFFFFFF))
22+
#define HI_BITS(x) (static_cast<unsigned>((x) >> 32))
23+
#define LO_BITS(x) (static_cast<unsigned>((x)&0x00000000FFFFFFFF))
2424

2525
namespace cunumeric {
2626

0 commit comments

Comments
 (0)