From: Tomas Hruby Date: Thu, 23 Sep 2010 14:42:26 +0000 (+0000) Subject: neg64() makes a 64bit integer negative X-Git-Tag: v3.2.0~804 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/Bv9ARM.html?a=commitdiff_plain;h=274fcf8d1f9b0b7115bf3a7c02c9081581fa18a7;p=minix.git 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 --- 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 */