BeRTOS
Defines | Functions
cpu/byteorder.h File Reference

Functions to convert integers to/from host byte-order. More...

#include <cfg/compiler.h>
#include <cpu/attr.h>
#include <cpu/detect.h>
#include <cpu/types.h>
#include <cfg/macros.h>
#include <cpu/irq.h>

Go to the source code of this file.

Defines

#define SWAB16(x)
 Swap upper and lower bytes in a 16-bit value.
#define SWAB32(x)
 Reverse bytes in a 32-bit value (e.g.
#define SWAB64(x)
 Reverse bytes in a 64-bit value.

Functions

float swab_float (float x)
 Reverse bytes in a float value.

Detailed Description

Functions to convert integers to/from host byte-order.

Author:
Bernie Innocenti <bernie@codewiz.org>
Stefano Fedrigo <aleph@develer.com>

Definition in file cpu/byteorder.h.


Define Documentation

#define SWAB32 (   x)
Value:
((uint32_t)(( \
    (ROTR(x, 8) & 0xFF00FF00) | \
    (ROTL(x, 8) & 0x00FF00FF))) + \
        STATIC_ASSERT_EXPR(sizeof(x) == sizeof(uint32_t)))

Reverse bytes in a 32-bit value (e.g.

: 0x12345678 -> 0x78563412).

Definition at line 64 of file cpu/byteorder.h.