pbit

Date:

10-12-2011

NAME

_pbit, _pbits - Pushes (copies) bits from one variable to another

SYNOPSIS

#include<intrinsics.h>

long _pbit (long x, long n, long y);

long _pbits (long x, long m, long n, long y);

IMPLEMENTATION

Cray Linux Environment (CLE)

STANDARDS

C extensions

DESCRIPTION

The _pbit function copies the rightmost bit of variable y to the nth bit of variable x and returns the modified x.

The _pbits function copies the rightmost m bits from variable y into m bits of variable x starting from bit n and going left. The function returns the modified x.

These functions accept the following variables:

x

The variable to receive the bits.

m

A value in the range of 0 through 63.

n

A value in the range of 0 through 63.

NOTES

Because these are intrinsic functions, no externally visible library functions are available for them. The compiler generates inline code to produce the result.

EXAMPLES

Program source:

main()
{
   long x = 0;
   long y = 0x0123456789abcdef;
   printf("_pbit(x, 10, y) = %lx\n", _pbit(x, 10, y));
   printf("_pbits(x, 12, 32, y) = %lx\n", _pbits(x, 12, 32, y));
}

Execution output:

_pbit(x, 10, y) = 400
_pbits(x, 12, 32, y) = def00000000

SEE ALSO

For a complete list of C intrinsic functions, see the Cray C and C++ Reference Manual