Echelon Neuron C Manual de usuario Pagina 127

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 267
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 126
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.
Vista de pagina 126
1 2 ... 122 123 124 125 126 127 128 129 130 131 132 ... 266 267

Comentarios a estos manuales

Sin comentarios