Rotate_long_left( ) function, Syntax, Example – Echelon Neuron C User Manual

Page 148: Rotate_long_right( ) function

Advertising
background image

128

Functions

value = reverse(value);

// now value is 0xC7

}

rotate_long_left( )

Function

The rotate_long_left( ) function returns the bit-rotated value of

arg

. The bit

positions are rotated the number of places determined by the

count

argument.

The signedness of the argument does not affect the result. Bits that are rotated

out from the upper end of the value are rotated back in at the lower end. See also
rotate_long_right( ), rotate_short_left( ), and rotate_short_right( ).

Syntax

#include <byte.h>

long rotate_long_left (long

arg

, unsigned

count

);

Example

#include <byte.h>

void f(void)
{
long

k;


k = 0x3F00;

k = rotate_long_left(k, 3);

// k now contains 0xF801
}

rotate_long_right( )

Function

The rotate_long_right( ) function returns the bit-rotated value of

arg

. The bit

positions are rotated the number of places determined by the

count

argument.

The signedness of the argument does not affect the result. Bits that are rotated

out from the lower end of the value are rotated back in at the upper end. See also

rotate_long_left( ), rotate_short_left( ), and rotate_short_right( ).

Syntax

#include <byte.h>

long rotate_long_right (long

arg

, unsigned

count

);

Example

#include <byte.h>

void f(void)
{
long

k;


k = 0x3F04;

k = rotate_long_right(k, 3);

Advertising