diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2016-10-11 17:52:54 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2016-10-12 09:35:55 +0300 |
commit | 53726beb93453583ce8413791dc731d1779e959d (patch) | |
tree | ab4c2c6be0dbfaad87cb0c915101f9fe36ef5610 /tests | |
parent | d703691650ee8e6c3922f04f3a26f8827855cfad (diff) | |
download | libatomic_ops-53726beb93453583ce8413791dc731d1779e959d.tar.gz |
Eliminate 'ISO C90 does not support long long' compiler pedantic warning
Long (32-bit) type is sufficient to represent time delta (duration)
in test_stack.
* tests/test_stack.c (get_msecs): Change return type from long long
to unsigned long (use lowest 32 bits of time value).
* tests/test_stack.c (main): Change type of start_time local variable
to unsigned long; remove redundant type cast.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_stack.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/tests/test_stack.c b/tests/test_stack.c index 0da8347..c21a881 100644 --- a/tests/test_stack.c +++ b/tests/test_stack.c @@ -55,23 +55,22 @@ # define get_msecs() 0 #elif defined(USE_WINTHREADS) || defined(AO_USE_WIN32_PTHREADS) # include <sys/timeb.h> - long long get_msecs(void) + unsigned long get_msecs(void) { struct timeb tb; ftime(&tb); - return (long long)tb.time * 1000 + tb.millitm; + return (unsigned long)tb.time * 1000 + tb.millitm; } #else /* Unix */ # include <time.h> # include <sys/time.h> - /* Need 64-bit long long support */ - long long get_msecs(void) + unsigned long get_msecs(void) { struct timeval tv; gettimeofday(&tv, 0); - return (long long)tv.tv_sec * 1000 + tv.tv_usec/1000; + return (unsigned long)tv.tv_sec * 1000 + tv.tv_usec/1000; } #endif /* !NO_TIMES */ @@ -244,7 +243,7 @@ int main(int argc, char **argv) pthread_t thread[MAX_NTHREADS]; # endif int list_length = nthreads*(nthreads+1)/2; - long long start_time; + unsigned long start_time; list_element * le; # ifdef VERBOSE @@ -292,7 +291,7 @@ int main(int argc, char **argv) abort(); } } - times[nthreads][exper_n] = (unsigned long)(get_msecs() - start_time); + times[nthreads][exper_n] = get_msecs() - start_time; # ifdef VERBOSE printf("nthreads=%d, time_ms=%lu\n", nthreads, times[nthreads][exper_n]); |