From 5fadc0cbb8577c61d66bd6f19ceaf0507c11e23b Mon Sep 17 00:00:00 2001 From: Jannis Hoffmann Date: Tue, 9 Jul 2024 14:41:53 +0200 Subject: initial clang-format --- src/taia.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'src/taia.c') diff --git a/src/taia.c b/src/taia.c index 22bd816..3b8cb8a 100644 --- a/src/taia.c +++ b/src/taia.c @@ -1,7 +1,8 @@ -#include -#include #include "taia.h" +#include +#include + /** @file taia.c @author djb @@ -11,7 +12,7 @@ /* XXX: breaks tai encapsulation */ -void taia_add(struct taia *t,struct taia *u,struct taia *v) +void taia_add(struct taia *t, struct taia *u, struct taia *v) { t->sec.x = u->sec.x + v->sec.x; t->nano = u->nano + v->nano; @@ -36,7 +37,7 @@ double taia_frac(struct taia *t) return (t->atto * 0.000000001 + t->nano) * 0.000000001; } -int taia_less(struct taia *t,struct taia *u) +int taia_less(struct taia *t, struct taia *u) { if (t->sec.x < u->sec.x) return 1; if (t->sec.x > u->sec.x) return 0; @@ -48,8 +49,8 @@ int taia_less(struct taia *t,struct taia *u) int taia_now(struct taia *t) { struct timeval now; - if (gettimeofday(&now,(struct timezone *) 0) == 0) { - tai_unix(&t->sec,now.tv_sec); + if (gettimeofday(&now, (struct timezone *)0) == 0) { + tai_unix(&t->sec, now.tv_sec); t->nano = 1000 * now.tv_usec + 500; t->atto = 0; return 0; @@ -59,26 +60,32 @@ int taia_now(struct taia *t) return -1; } -void taia_pack(char *s,struct taia *t) +void taia_pack(char *s, struct taia *t) { unsigned long x; - tai_pack(s,&t->sec); + tai_pack(s, &t->sec); s += 8; x = t->atto; - s[7] = x & 255; x >>= 8; - s[6] = x & 255; x >>= 8; - s[5] = x & 255; x >>= 8; + s[7] = x & 255; + x >>= 8; + s[6] = x & 255; + x >>= 8; + s[5] = x & 255; + x >>= 8; s[4] = x; x = t->nano; - s[3] = x & 255; x >>= 8; - s[2] = x & 255; x >>= 8; - s[1] = x & 255; x >>= 8; + s[3] = x & 255; + x >>= 8; + s[2] = x & 255; + x >>= 8; + s[1] = x & 255; + x >>= 8; s[0] = x; } -void taia_sub(struct taia *t,struct taia *u,struct taia *v) +void taia_sub(struct taia *t, struct taia *u, struct taia *v) { unsigned long unano = u->nano; unsigned long uatto = u->atto; @@ -96,7 +103,7 @@ void taia_sub(struct taia *t,struct taia *u,struct taia *v) } } -void taia_uint(struct taia *t,unsigned int s) +void taia_uint(struct taia *t, unsigned int s) { t->sec.x = s; t->nano = 0; -- cgit v1.2.3