From 53726beb93453583ce8413791dc731d1779e959d Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Tue, 11 Oct 2016 17:52:54 +0300 Subject: 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. --- tests/test_stack.c | 13 ++++++------- 1 file 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 - 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 # include - /* 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]); -- cgit v1.2.1