#include <ggi/internal/triple-int.h> int sign_3(unsigned x); int bits_3(unsigned x); int eq0_3(unsigned x); int gt0_3(unsigned x); int ge0_3(unsigned x); int lt0_3(unsigned x); int le0_3(unsigned x);
bits_3 counts the number of significant bits of x. I.e. leading zeros in a positive value and leading ones in a negative value are not counted.
eq0_3, gt0_3, ge0_3, lt0_3 and le0_3 tests the relation between x and zero. eq0_3 tests if x is equal to zero, gt0_3 if x is greater than zero, ge0_3 if x is greater than or equal to zero, lt0_3 if x is less than zero and last but not least le0_3 tests if x is less than or equal to zero.
bits_3 returns 0 for x equal to 0 or -1, 1 for x equal to 1 and -2, 2 for x equal to 2, 3, -3 and -4 etc.
unsigned x; assign_int_3(x, 5); ASSERT(sign_3(x) == 1); ASSERT(bits_3(x) == 3); ASSERT(!eq0_3(x)); ASSERT(gt0_3(x)); ASSERT(ge0_3(x)); ASSERT(!lt0_3(x)); ASSERT(!le0_3(x));