Skip to content

Commit

Permalink
fix bug on threading on different platform
Browse files Browse the repository at this point in the history
Signed-off-by: Dongcan Jiang <dongcan.jiang@gmail.com>
  • Loading branch information
Dongcan-Jiang committed Aug 17, 2015
1 parent 519d751 commit c366be8
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 48 deletions.
6 changes: 3 additions & 3 deletions src/colCounts.c
Expand Up @@ -56,12 +56,12 @@ SEXP colCounts(SEXP x, SEXP dim, SEXP rows, SEXP cols, SEXP value, SEXP what, SE
void *ccols = validateIndices(cols, ncol, 0, &ncols, &colsType);

#ifdef _USE_PTHREAD_
cores2 = 1;
#else
/* Argument 'cores': */
cores2 = asInteger(cores);
if (cores2 <= 0)
error("Argument 'cores' must be a positive value.")
error("Argument 'cores' must be a positive value.");
#else
cores2 = 1;
#endif

/* R allocate an integer vector of length 'ncol' */
Expand Down
6 changes: 3 additions & 3 deletions src/colOrderStats.c
Expand Up @@ -64,12 +64,12 @@ SEXP colOrderStats(SEXP x, SEXP dim, SEXP rows, SEXP cols, SEXP which, SEXP core
}

#ifdef _USE_PTHREAD_
cores2 = 1;
#else
/* Argument 'cores': */
cores2 = asInteger(cores);
if (cores2 <= 0)
error("Argument 'cores' must be a positive value.")
error("Argument 'cores' must be a positive value.");
#else
cores2 = 1;
#endif

/* Double matrices are more common to use. */
Expand Down
6 changes: 3 additions & 3 deletions src/colRanges.c
Expand Up @@ -55,12 +55,12 @@ SEXP colRanges(SEXP x, SEXP dim, SEXP rows, SEXP cols, SEXP what, SEXP naRm, SEX
void *ccols = validateIndices(cols, ncol, 0, &ncols, &colsType);

#ifdef _USE_PTHREAD_
cores2 = 1;
#else
/* Argument 'cores': */
cores2 = asInteger(cores);
if (cores2 <= 0)
error("Argument 'cores' must be a positive value.")
error("Argument 'cores' must be a positive value.");
#else
cores2 = 1;
#endif

is_counted = (int *) R_alloc(ncols, sizeof(int));
Expand Down
6 changes: 3 additions & 3 deletions src/rowCounts.c
Expand Up @@ -56,12 +56,12 @@ SEXP rowCounts(SEXP x, SEXP dim, SEXP rows, SEXP cols, SEXP value, SEXP what, SE
void *ccols = validateIndices(cols, ncol, 0, &ncols, &colsType);

#ifdef _USE_PTHREAD_
cores2 = 1;
#else
/* Argument 'cores': */
cores2 = asInteger(cores);
if (cores2 <= 0)
error("Argument 'cores' must be a positive value.")
error("Argument 'cores' must be a positive value.");
#else
cores2 = 1;
#endif

/* R allocate a double vector of length 'nrow' */
Expand Down
12 changes: 6 additions & 6 deletions src/rowCumMinMaxs.c
Expand Up @@ -42,12 +42,12 @@ SEXP rowCummins(SEXP x, SEXP dim, SEXP rows, SEXP cols, SEXP byRow, SEXP cores)
byrow = asLogical(byRow);

#ifdef _USE_PTHREAD_
cores2 = 1;
#else
/* Argument 'cores': */
cores2 = asInteger(cores);
if (cores2 <= 0)
error("Argument 'cores' must be a positive value.")
error("Argument 'cores' must be a positive value.");
#else
cores2 = 1;
#endif

int *oks = NULL;
Expand Down Expand Up @@ -99,12 +99,12 @@ SEXP rowCummaxs(SEXP x, SEXP dim, SEXP rows, SEXP cols, SEXP byRow, SEXP cores)
byrow = asLogical(byRow);

#ifdef _USE_PTHREAD_
cores2 = 1;
#else
/* Argument 'cores': */
cores2 = asInteger(cores);
if (cores2 <= 0)
error("Argument 'cores' must be a positive value.")
error("Argument 'cores' must be a positive value.");
#else
cores2 = 1;
#endif

int *oks = NULL;
Expand Down
6 changes: 3 additions & 3 deletions src/rowCumprods.c
Expand Up @@ -40,12 +40,12 @@ SEXP rowCumprods(SEXP x, SEXP dim, SEXP rows, SEXP cols, SEXP byRow, SEXP cores)
byrow = asLogical(byRow);

#ifdef _USE_PTHREAD_
cores2 = 1;
#else
/* Argument 'cores': */
cores2 = asInteger(cores);
if (cores2 <= 0)
error("Argument 'cores' must be a positive value.")
error("Argument 'cores' must be a positive value.");
#else
cores2 = 1;
#endif

int *oks = NULL;
Expand Down
6 changes: 3 additions & 3 deletions src/rowCumsums.c
Expand Up @@ -40,12 +40,12 @@ SEXP rowCumsums(SEXP x, SEXP dim, SEXP rows, SEXP cols, SEXP byRow, SEXP cores)
byrow = asLogical(byRow);

#ifdef _USE_PTHREAD_
cores2 = 1;
#else
/* Argument 'cores': */
cores2 = asInteger(cores);
if (cores2 <= 0)
error("Argument 'cores' must be a positive value.")
error("Argument 'cores' must be a positive value.");
#else
cores2 = 1;
#endif

int *oks = NULL;
Expand Down
6 changes: 3 additions & 3 deletions src/rowDiffs.c
Expand Up @@ -54,12 +54,12 @@ SEXP rowDiffs(SEXP x, SEXP dim, SEXP rows, SEXP cols, SEXP lag, SEXP differences
byrow = asLogical(byRow);

#ifdef _USE_PTHREAD_
cores2 = 1;
#else
/* Argument 'cores': */
cores2 = asInteger(cores);
if (cores2 <= 0)
error("Argument 'cores' must be a positive value.")
error("Argument 'cores' must be a positive value.");
#else
cores2 = 1;
#endif

/* Dimension of result matrix */
Expand Down
6 changes: 3 additions & 3 deletions src/rowLogSumExp.c
Expand Up @@ -45,12 +45,12 @@ SEXP rowLogSumExps(SEXP lx, SEXP dim, SEXP rows, SEXP cols, SEXP naRm, SEXP hasN
byrow = asLogical(byRow);

#ifdef _USE_PTHREAD_
cores2 = 1;
#else
/* Argument 'cores': */
cores2 = asInteger(cores);
if (cores2 <= 0)
error("Argument 'cores' must be a positive value.")
error("Argument 'cores' must be a positive value.");
#else
cores2 = 1;
#endif

if (byrow) {
Expand Down
6 changes: 3 additions & 3 deletions src/rowMads.c
Expand Up @@ -53,12 +53,12 @@ SEXP rowMads(SEXP x, SEXP dim, SEXP rows, SEXP cols, SEXP constant, SEXP naRm, S
byrow = asLogical(byRow);

#ifdef _USE_PTHREAD_
cores2 = 1;
#else
/* Argument 'cores': */
cores2 = asInteger(cores);
if (cores2 <= 0)
error("Argument 'cores' must be a positive value.")
error("Argument 'cores' must be a positive value.");
#else
cores2 = 1;
#endif

if (!byrow) {
Expand Down
6 changes: 3 additions & 3 deletions src/rowMedians.c
Expand Up @@ -47,12 +47,12 @@ SEXP rowMedians(SEXP x, SEXP dim, SEXP rows, SEXP cols, SEXP naRm, SEXP hasNA, S
byrow = asLogical(byRow);

#ifdef _USE_PTHREAD_
cores2 = 1;
#else
/* Argument 'cores': */
cores2 = asInteger(cores);
if (cores2 <= 0)
error("Argument 'cores' must be a positive value.")
error("Argument 'cores' must be a positive value.");
#else
cores2 = 1;
#endif

if (!byrow) {
Expand Down
6 changes: 3 additions & 3 deletions src/rowOrderStats.c
Expand Up @@ -64,12 +64,12 @@ SEXP rowOrderStats(SEXP x, SEXP dim,SEXP rows, SEXP cols, SEXP which, SEXP cores
}

#ifdef _USE_PTHREAD_
cores2 = 1;
#else
/* Argument 'cores': */
cores2 = asInteger(cores);
if (cores2 <= 0)
error("Argument 'cores' must be a positive value.")
error("Argument 'cores' must be a positive value.");
#else
cores2 = 1;
#endif

/* Double matrices are more common to use. */
Expand Down
6 changes: 3 additions & 3 deletions src/rowRanges.c
Expand Up @@ -55,12 +55,12 @@ SEXP rowRanges(SEXP x, SEXP dim, SEXP rows, SEXP cols, SEXP what, SEXP naRm, SEX
void *ccols = validateIndices(cols, ncol, 0, &ncols, &colsType);

#ifdef _USE_PTHREAD_
cores2 = 1;
#else
/* Argument 'cores': */
cores2 = asInteger(cores);
if (cores2 <= 0)
error("Argument 'cores' must be a positive value.")
error("Argument 'cores' must be a positive value.");
#else
cores2 = 1;
#endif

is_counted = (int *) R_alloc(nrows, sizeof(int));
Expand Down
6 changes: 3 additions & 3 deletions src/rowRanksWithTies.c
Expand Up @@ -126,12 +126,12 @@ SEXP rowRanksWithTies(SEXP x, SEXP dim, SEXP rows, SEXP cols, SEXP tiesMethod, S
byrow = asLogical(byRow);

#ifdef _USE_PTHREAD_
cores2 = 1;
#else
/* Argument 'cores': */
cores2 = asInteger(cores);
if (cores2 <= 0)
error("Argument 'cores' must be a positive value.")
error("Argument 'cores' must be a positive value.");
#else
cores2 = 1;
#endif

/* Double matrices are more common to use. */
Expand Down
6 changes: 3 additions & 3 deletions src/rowVars.c
Expand Up @@ -50,12 +50,12 @@ SEXP rowVars(SEXP x, SEXP dim, SEXP rows, SEXP cols, SEXP naRm, SEXP hasNA, SEXP
byrow = asLogical(byRow);

#ifdef _USE_PTHREAD_
cores2 = 1;
#else
/* Argument 'cores': */
cores2 = asInteger(cores);
if (cores2 <= 0)
error("Argument 'cores' must be a positive value.")
error("Argument 'cores' must be a positive value.");
#else
cores2 = 1;
#endif

if (!byrow) {
Expand Down

0 comments on commit c366be8

Please sign in to comment.