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
This commit is contained in:
Tomas Hruby 2010-09-23 14:42:26 +00:00
parent 8eece1c00c
commit 274fcf8d1f

View file

@ -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 */