[hackers] [libgrapheme] Coding style and explicit double-cast || Laslo Hunhold

From: <git_AT_suckless.org>
Date: Tue, 14 Dec 2021 12:51:56 +0100 (CET)

commit 24255ed919b2a40830954ef47df6901e566f46aa
Author: Laslo Hunhold <dev_AT_frign.de>
AuthorDate: Tue Dec 14 12:51:31 2021 +0100
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Tue Dec 14 12:51:31 2021 +0100

    Coding style and explicit double-cast
    
    Signed-off-by: Laslo Hunhold <dev_AT_frign.de>

diff --git a/test/grapheme-performance.c b/test/grapheme-performance.c
index 30fdc3a..4ad770f 100644
--- a/test/grapheme-performance.c
+++ b/test/grapheme-performance.c
_AT_@ -11,7 +11,8 @@
 #define LEN(x) (sizeof(x) / sizeof(*(x)))
 #define NUM_ITERATIONS 10000
 
-int64_t time_diff(struct timespec *a, struct timespec *b)
+static int64_t
+time_diff(struct timespec *a, struct timespec *b)
 {
         return ((b->tv_sec * 1000000000) + b->tv_nsec) -
                ((a->tv_sec * 1000000000) + a->tv_nsec);
_AT_@ -57,8 +58,8 @@ main(void)
                 }
         }
         clock_gettime(CLOCK_MONOTONIC, &end);
- cp_per_sec = ((double)NUM_ITERATIONS * bufsiz) /
- ((double)time_diff(&start, &end) / 1000000000);
+ cp_per_sec = ((double)NUM_ITERATIONS * (double)bufsiz) /
+ (time_diff(&start, &end) / 1000000000);
 
         printf(" %.2e CP/s\n", cp_per_sec);
 
Received on Tue Dec 14 2021 - 12:51:56 CET

This archive was generated by hypermail 2.3.0 : Tue Dec 14 2021 - 13:00:33 CET