Skip to content

Commit

Permalink
Use ptrdiff_t literal suffix Z
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeshingles committed Nov 19, 2024
1 parent 3276e3f commit 2f5f362
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions nonthermal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ void read_auger_data() {
float n_auger_elec_avg = 0;
double prob_num_auger[NT_MAX_AUGER_ELECTRONS + 1];
for (int a = 0; a < 9; a++) {
linepos = line + static_cast<ptrdiff_t>(26 + (a * 5));
linepos = line + 26 + (a * 5);
// have to read out exactly 5 characters at a time because the columns are sometimes not separated by a space
char strprob[6] = "00000";
assert_always(sscanf(linepos, "%5c%n", strprob, &offset) == 1);
Expand Down Expand Up @@ -485,7 +485,7 @@ auto get_approx_shell_occupancies(const int nbound, const int ioncharge) {
assert_always(ioncharge >= 0);
const int Z = nbound + ioncharge;
std::vector<int> q;
q.resize(std::max(static_cast<size_t>(10), elements_electron_binding[Z - 1].size()), 0);
q.resize(std::max(10UZ, elements_electron_binding[Z - 1].size()), 0);

for (int electron_loop = 0; electron_loop < nbound; electron_loop++) {
if (q[0] < 2) {
Expand Down
4 changes: 2 additions & 2 deletions sn3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,8 @@ constexpr auto get_range_chunk(const ptrdiff_t size, const ptrdiff_t nchunks, co
assert_always(nchunk >= 0);
const auto minchunksize = size / nchunks; // integer division, minimum non-empty cells per process
const auto n_remainder = size % nchunks;
const auto nstart = ((minchunksize + 1) * std::min(n_remainder, nchunk)) +
(minchunksize * std::max(static_cast<ptrdiff_t>(0), nchunk - n_remainder));
const auto nstart =
((minchunksize + 1) * std::min(n_remainder, nchunk)) + (minchunksize * std::max(0Z, nchunk - n_remainder));
const auto nsize = (nchunk < n_remainder) ? minchunksize + 1 : minchunksize;
assert_testmodeonly(nstart >= 0);
assert_testmodeonly(nsize >= 0);
Expand Down
2 changes: 1 addition & 1 deletion stats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void normalise_ion_estimators(const int nonemptymgi, const double deltat, const
__host__ __device__ void increment(enum eventcounters i) {
assert_testmodeonly(i >= 0);
assert_testmodeonly(i < COUNTER_COUNT);
atomicadd(eventstats[i], static_cast<ptrdiff_t>(1));
atomicadd(eventstats[i], 1Z);
}

void pkt_action_counters_reset() {
Expand Down

0 comments on commit 2f5f362

Please sign in to comment.