Skip to content

Commit 918310c

Browse files
committed
tests: fix -Werror,-Wimplicit-int-float-conversion
``` testes/dispatch_timer_short.c:58:74: error: implicit conversion from 'unsigned long long' to 'double' may loose precision [-Werror,-Wimplicit-int-float-conversion] test_long_less_than("Frequency", 1, (long)ceil((double)delay/(finalCount*interval))); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~ ``` Fix the casting for `finalCount` and explicitly cast the result which would be an `unsigned long long` due to the multiplication by `interval`.
1 parent afd6b6d commit 918310c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/dispatch_timer_short.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,11 @@ static
5252
void
5353
test_fin(void *cxt)
5454
{
55-
unsigned long finalCount = (unsigned long)count;
55+
uint32_t finalCount = (uint32_t)count;
5656
fprintf(stderr, "Called back every %llu us on average\n",
5757
(delay/finalCount)/NSEC_PER_USEC);
58-
test_long_less_than("Frequency", 1, (long)ceil((double)delay/(finalCount*interval)));
58+
test_long_less_than("Frequency", 1,
59+
(long)ceil((double)delay/(double)(finalCount*interval)));
5960
int i;
6061
for (i = 0; i < N; i++) {
6162
dispatch_source_cancel(t[i]);

0 commit comments

Comments
 (0)