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

Page 149: Rotate_short_right( ) function

Advertising
background image

Neuron C Reference Guide

129

// k now contains 0x87E0
}

rotate_short_left( )

Function

The rotate_short_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_left( ), rotate_long_right( ), and rotate_short_right( ).

Syntax

#include <byte.h>
short rotate_short_left (short

arg

, unsigned

count

);

Example

#include <byte.h>

void f(void)
{
short

s;


s = 0x3F;

s = rotate_short_left(s, 3);

// s now contains 0xF9
}

rotate_short_right( )

Function

The rotate_short_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_long_right( ), and rotate_short_left( ).

Syntax

#include <byte.h>

short rotate_short_right (short

arg

, unsigned

count

);

Example

#include <byte.h>

void f(void)
{
short

s;


s = 0x3F;

s = rotate_short_right(s, 3);

// s now contains 0xE7

Advertising