From 0df54d980737b7c4bb07aa4ac29e1e7689a6019b Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Wed, 15 Jul 2009 09:09:48 +0100 Subject: minios: switch to C99 integer types This is a necessary step to make minios build on NetBSD. Signed-off-by: Christoph Egger --- extras/mini-os/lib/math.c | 28 ++++++++++++++-------------- extras/mini-os/lib/sys.c | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'extras/mini-os/lib') diff --git a/extras/mini-os/lib/math.c b/extras/mini-os/lib/math.c index f1f7826080..55ece1ed51 100644 --- a/extras/mini-os/lib/math.c +++ b/extras/mini-os/lib/math.c @@ -68,8 +68,8 @@ * one or more of the following formats. */ union uu { - s64 q; /* as a (signed) quad */ - s64 uq; /* as an unsigned quad */ + int64_t q; /* as a (signed) quad */ + int64_t uq; /* as an unsigned quad */ long sl[2]; /* as two signed longs */ unsigned long ul[2]; /* as two unsigned longs */ }; @@ -90,7 +90,7 @@ union uu { #ifndef HAVE_LIBC #define CHAR_BIT 8 /* number of bits in a char */ #endif -#define QUAD_BITS (sizeof(s64) * CHAR_BIT) +#define QUAD_BITS (sizeof(int64_t) * CHAR_BIT) #define LONG_BITS (sizeof(long) * CHAR_BIT) #define HALF_BITS (sizeof(long) * CHAR_BIT / 2) @@ -147,8 +147,8 @@ shl(register digit *p, register int len, register int sh) * divisor are 4 `digits' in this base (they are shorter if they have * leading zeros). */ -u64 -__qdivrem(u64 uq, u64 vq, u64 *arq) +uint64_t +__qdivrem(uint64_t uq, uint64_t vq, uint64_t *arq) { union uu tmp; digit *u, *v, *q; @@ -348,31 +348,31 @@ __qdivrem(u64 uq, u64 vq, u64 *arq) * Divide two signed quads. * ??? if -1/2 should produce -1 on this machine, this code is wrong */ -s64 -__divdi3(s64 a, s64 b) +int64_t +__divdi3(int64_t a, int64_t b) { - u64 ua, ub, uq; + uint64_t ua, ub, uq; int neg; if (a < 0) - ua = -(u64)a, neg = 1; + ua = -(uint64_t)a, neg = 1; else ua = a, neg = 0; if (b < 0) - ub = -(u64)b, neg ^= 1; + ub = -(uint64_t)b, neg ^= 1; else ub = b; - uq = __qdivrem(ua, ub, (u64 *)0); + uq = __qdivrem(ua, ub, (uint64_t *)0); return (neg ? -uq : uq); } /* * Divide two unsigned quads. */ -u64 -__udivdi3(u64 a, u64 b) +uint64_t +__udivdi3(uint64_t a, uint64_t b) { - return (__qdivrem(a, b, (u64 *)0)); + return (__qdivrem(a, b, (uint64_t *)0)); } diff --git a/extras/mini-os/lib/sys.c b/extras/mini-os/lib/sys.c index 166ecc9c09..8cb5d28479 100644 --- a/extras/mini-os/lib/sys.c +++ b/extras/mini-os/lib/sys.c @@ -1189,7 +1189,7 @@ int clock_gettime(clockid_t clk_id, struct timespec *tp) } case CLOCK_REALTIME: { - u64 nsec = monotonic_clock(); + uint64_t nsec = monotonic_clock(); tp->tv_sec = nsec / 1000000000ULL; tp->tv_nsec = nsec % 1000000000ULL; -- cgit v1.2.3