Skip to content

Commit

Permalink
NFFT#18: Use macro NFFT__D__ / __D__ instead of string "%td" to print…
Browse files Browse the repository at this point in the history
… out data type ptrdiff_t. __D__ is defined as "%Id" on Windows and "%td" otherwise.
  • Loading branch information
tvolkmer authored and jenskeiner committed Apr 20, 2016
1 parent de25dd1 commit 58a04d8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/nfft/simple_test_threads.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main(void)
const int M = 1000000;
NFFT_R t0, t1;

printf("nthreads = %td\n", NFFT(get_num_threads)());
printf("nthreads = " NFFT__D__ "\n", NFFT(get_num_threads)());

/* init */
FFTW(init_threads)();
Expand Down
6 changes: 5 additions & 1 deletion include/infft.h
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,11 @@ extern double _Complex catanh(double _Complex z);
#define TRUE 1
#define FALSE 0

#define __D__ "%td"
#if defined(_WIN32) || defined(_WIN64)
# define __D__ "%Id"
#else
# define __D__ "%td"
#endif

/** Dummy use of unused parameters to silence compiler warnings */
#define UNUSED(x) (void)x
Expand Down
6 changes: 6 additions & 0 deletions include/nfft3mp.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,10 @@ typedef double _Complex NFFT_C;

#define NFFT_KPI NFFT_K(3.1415926535897932384626433832795028841971693993751)

#if defined(_WIN32) || defined(_WIN64)
# define NFFT__D__ "%Id"
#else
# define NFFT__D__ "%td"
#endif

#endif /* defined(__NFFT3MP_H__) */
6 changes: 3 additions & 3 deletions tests/nfft.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ static void setup_file(const testcase_delegate_t *ego_, int *d, int **N, int *NN
printf(" M = %-5d", *M);

#ifdef _OPENMP
printf(" nthreads = %td", X(get_num_threads)());
printf(" nthreads = " __D__, X(get_num_threads)());
#endif

for (j = 0, *NN = 1; j < *d; j++)
Expand Down Expand Up @@ -485,7 +485,7 @@ static void setup_online(const testcase_delegate_t *ego_, int *d, int **N, int *
printf(" M = %-5d", *M);

#ifdef _OPENMP
printf(" nthreads = %td", X(get_num_threads)());
printf(" nthreads = " __D__, X(get_num_threads)());
#endif

for (j = 0, *NN = 1; j < *d; j++)
Expand Down Expand Up @@ -573,7 +573,7 @@ static void setup_adjoint_online(const testcase_delegate_t *ego_, int *d, int **
printf(" M = %-5d", *M);

#ifdef _OPENMP
printf(" nthreads = %td", X(get_num_threads)());
printf(" nthreads = " __D__, X(get_num_threads)());
#endif

for (j = 0, *NN = 1; j < *d; j++)
Expand Down

0 comments on commit 58a04d8

Please sign in to comment.