Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit ae88e95

Browse files
authored
Change num_spikes datatype to unsigned long (#878)
* Change datatype from the number of spikes and buffer size to unsigned long * Change unsigned long for size_t
1 parent 5065f8c commit ae88e95

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

coreneuron/io/output_spikes.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ static void output_spikes_parallel(const char* outpath, const SpikesInfo& spikes
218218

219219
// each spike record in the file is time + gid (64 chars sufficient)
220220
const int SPIKE_RECORD_LEN = 64;
221-
unsigned num_spikes = spikevec_gid.size();
222-
unsigned num_bytes = (sizeof(char) * num_spikes * SPIKE_RECORD_LEN);
221+
size_t num_spikes = spikevec_gid.size();
222+
size_t num_bytes = (sizeof(char) * num_spikes * SPIKE_RECORD_LEN);
223223
char* spike_data = (char*) malloc(num_bytes);
224224

225225
if (spike_data == nullptr) {
@@ -232,8 +232,8 @@ static void output_spikes_parallel(const char* outpath, const SpikesInfo& spikes
232232

233233
// populate buffer with all spike entries
234234
char spike_entry[SPIKE_RECORD_LEN];
235-
unsigned spike_data_offset = 0;
236-
for (unsigned i = 0; i < num_spikes; i++) {
235+
size_t spike_data_offset = 0;
236+
for (size_t i = 0; i < num_spikes; i++) {
237237
int spike_entry_chars =
238238
snprintf(spike_entry, 64, "%.8g\t%d\n", spikevec_time[i], spikevec_gid[i]);
239239
spike_data_offset =
@@ -242,7 +242,7 @@ static void output_spikes_parallel(const char* outpath, const SpikesInfo& spikes
242242

243243
// calculate offset into global file. note that we don't write
244244
// all num_bytes but only "populated" buffer
245-
unsigned long num_chars = strlen(spike_data);
245+
size_t num_chars = strlen(spike_data);
246246

247247
nrnmpi_write_file(fname, spike_data, num_chars);
248248

0 commit comments

Comments
 (0)