ggidev-lt0_3(3) triple-int properties

Other Alias

ggidev-sign_3, ggidev-bits_3, ggidev-eq0_3, ggidev-gt0_3, ggidev-ge0_3, ggidev-le0_3

## SYNOPSIS

#include <ggi/internal/triple-int.h>
int sign_3(unsigned x[3]);
int bits_3(unsigned x[3]);
int eq0_3(unsigned x[3]);
int gt0_3(unsigned x[3]);
int ge0_3(unsigned x[3]);
int lt0_3(unsigned x[3]);
int le0_3(unsigned x[3]);

## DESCRIPTION

sign_3 checks the sign of 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.

## RETURN VALUE

sign_3 returns -1 for negative values, 0 for zero values and 1 for positive values.

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.

eq0_3, gt0_3, ge0_3, lt0_3 and le0_3 all returns non-zero if the relation is true, and zero otherwise.

## EXAMPLES

Some triple-int tests:

unsigned x[3];
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));