ggidev-invert_3(3)

ggidev-invert_33

Bitwise triple-int operations

Usage

#include <ggi/internal/triple-int.h>
unsigned *invert_3(unsigned x[3]);
unsigned *lshift_3(unsigned l[3], unsigned r);
unsigned *rshift_3(unsigned l[3], unsigned r);

Overview

invert_3 inverts all bits of x. Equivalent to x=~x.

lshift_3 shifts l to the left by r bits. Equivalent to l<<=r.

rshift_3 shifts l to the right by r bits. This shift is arithmetic, so the sign of l is kept as is. Equivalent to l>>=r.

Return value

invert_3 returns a pointer to x which has been updated in place.

Both lshift_3 and rshift_3 return a pointer to l which has been updated in place.

Examples

Some bitwise operations on triple-ints:

unsigned x[3];
assign_int_3(x, -4);
invert_3(x);     /* x is now 3 */
lshift_3(x, 42); /* x is now 3*2^42, if that fits in a triple-int */
rshift_3(x, 17); /* x is now 3*2^25 */

Releases

3 releases since Debian 4.0 (Etch); the text changed 1 time.

  1. 4.0
  2. 5.0–6.0

From libggi2-dev 1:2.2.2-5 in Debian 6.0 (Squeeze). Parsed by carta from the page's man source.