Low_byte( ) built-in function, Syntax, Example – Echelon Neuron C User Manual

Page 127: Make_long( ) built-in function, Max( ) built-in function

Advertising
background image

Neuron C Reference Guide

107

low_byte( )

Built-in Function

The low_byte( ) built-in function extracts the lower single-byte value from the

double-byte operand

a

. This function operates without regard to signedness. See

also high_byte( ), make_long( ), and swap_bytes( ).

Syntax

unsigned short low_byte (unsigned long

a

);

Example

short b;
long a;

void f(void)
{

a = 258;

// Hex value 0x0102

b = low_byte(a);

// b now contains the value 0x02

}

make_long( )

Built-in Function

The make_long( ) built-in function combines the

low-byte

and

high-byte

single-

byte values

to make a double-byte value. This function operates without regard

to signedness of the operands. See also high_byte( ), low_byte( ), and
swap_bytes( ).

Syntax

unsigned long make_long (unsigned short

low-byte

,

unsigned short

high-byte

);

Example

short a, b;
long l;

void f(void)
{

a = 16;

// Hex value 0x10

b = -2;

// Hex value 0xFE

l = make_long(a, b); // l now contains 0xFE10

l = make_long(b, a); // l now contains 0x10FE

}

max( )

Built-in Function

The max( ) built-in function compares

a

and

b

and returns the larger value. The

result

type

is determined by the types of

a

and

b

, as shown in Table 30 on page

108.

Advertising