From 274fcf8d1f9b0b7115bf3a7c02c9081581fa18a7 Mon Sep 17 00:00:00 2001 From: Tomas Hruby Date: Thu, 23 Sep 2010 14:42:26 +0000 Subject: [PATCH] neg64() makes a 64bit integer negative - neg64(a) == -a - although we only support 64 bit unsigned arithmetics sometimes it's good to have a 2-complement negative number --- include/minix/u64.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/minix/u64.h b/include/minix/u64.h index 910d77c28..4eef3fec2 100644 --- a/include/minix/u64.h +++ b/include/minix/u64.h @@ -43,4 +43,10 @@ u64_t not64(u64_t a); #define is_zero64(i) ((i).lo == 0 && (i).hi == 0) #define make_zero64(i) do { (i).lo = (i).hi = 0; } while(0) +#define neg64(i) do { \ + (i).lo = ~(i).lo; \ + (i).hi = ~(i).hi; \ + (i) = add64u((i), 1); \ + } while(0) + #endif /* _MINIX__U64_H */ -- 2.44.0