Skip to content

Commit

Permalink
Merge pull request #70 from psteinb/fix_openmp_integertype_msvc
Browse files Browse the repository at this point in the history
using signed 64-bit integer for OpenMP under MSVC
  • Loading branch information
kiyo-masui committed Nov 5, 2018
2 parents 50e38ce + a584420 commit 0af8f0e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/bitshuffle_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
#include <arm_neon.h>
#endif

#if defined(_OPENMP) && defined(_MSC_VER)
typedef int64_t omp_size_t;
#else
typedef size_t omp_size_t;
#endif

// Macros.
#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
Expand Down Expand Up @@ -1662,7 +1667,7 @@ int64_t bshuf_untrans_bit_elem(const void* in, void* out, const size_t size,
int64_t bshuf_blocked_wrap_fun(bshufBlockFunDef fun, const void* in, void* out, \
const size_t size, const size_t elem_size, size_t block_size) {

long long ii; // msvc openmp pragma doesn't like size_t type
omp_size_t ii = 0;
int64_t err = 0;
int64_t count, cum_count=0;
size_t last_block_size;
Expand All @@ -1685,7 +1690,7 @@ int64_t bshuf_blocked_wrap_fun(bshufBlockFunDef fun, const void* in, void* out,
#pragma omp parallel for schedule(dynamic, 1) \
private(count) reduction(+ : cum_count)
#endif
for (ii = 0; ii < size / block_size; ii ++) {
for (ii = 0; ii < (omp_size_t)( size / block_size ); ii ++) {
count = fun(&C, block_size, elem_size);
if (count < 0) err = count;
cum_count += count;
Expand Down

0 comments on commit 0af8f0e

Please sign in to comment.