Byte order conversion. More...
#include "os_port.h"
Go to the source code of this file.
Functions | |
uint16_t | swapInt16 (uint16_t value) |
Reverse the byte order of a 16-bit word. More... | |
uint32_t | swapInt32 (uint32_t value) |
Reverse the byte order of a 32-bit word. More... | |
uint64_t | swapInt64 (uint64_t value) |
Reverse the byte order of a 64-bit word. More... | |
uint8_t | reverseInt4 (uint8_t value) |
Reverse bit order in a 4-bit word. More... | |
uint8_t | reverseInt8 (uint8_t value) |
Reverse bit order in a byte. More... | |
uint16_t | reverseInt16 (uint16_t value) |
Reverse bit order in a 16-bit word. More... | |
uint32_t | reverseInt32 (uint32_t value) |
Reverse bit order in a 32-bit word. More... | |
uint64_t | reverseInt64 (uint64_t value) |
Reverse bit order in a 64-bit word. More... | |
Detailed Description
Byte order conversion.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.4.4
Definition in file cpu_endian.h.
Macro Definition Documentation
◆ BETOH16
Definition at line 450 of file cpu_endian.h.
◆ betoh16
Definition at line 453 of file cpu_endian.h.
◆ BETOH32
Definition at line 451 of file cpu_endian.h.
◆ betoh32
Definition at line 454 of file cpu_endian.h.
◆ BETOH64
Definition at line 452 of file cpu_endian.h.
◆ betoh64
Definition at line 455 of file cpu_endian.h.
◆ HTOBE16
Definition at line 442 of file cpu_endian.h.
◆ htobe16
Definition at line 445 of file cpu_endian.h.
◆ HTOBE32
Definition at line 443 of file cpu_endian.h.
◆ htobe32
Definition at line 446 of file cpu_endian.h.
◆ HTOBE64
Definition at line 444 of file cpu_endian.h.
◆ htobe64
Definition at line 447 of file cpu_endian.h.
◆ HTOLE16
Definition at line 426 of file cpu_endian.h.
◆ htole16
Definition at line 429 of file cpu_endian.h.
◆ HTOLE32
Definition at line 427 of file cpu_endian.h.
◆ htole32
Definition at line 430 of file cpu_endian.h.
◆ HTOLE64
Definition at line 428 of file cpu_endian.h.
◆ htole64
Definition at line 431 of file cpu_endian.h.
◆ HTONL
Definition at line 411 of file cpu_endian.h.
◆ htonl
Definition at line 414 of file cpu_endian.h.
◆ HTONLL
Definition at line 412 of file cpu_endian.h.
◆ htonll
Definition at line 415 of file cpu_endian.h.
◆ HTONS
Definition at line 410 of file cpu_endian.h.
◆ htons
Definition at line 413 of file cpu_endian.h.
◆ LETOH16
Definition at line 434 of file cpu_endian.h.
◆ letoh16
Definition at line 437 of file cpu_endian.h.
◆ LETOH32
Definition at line 435 of file cpu_endian.h.
◆ letoh32
Definition at line 438 of file cpu_endian.h.
◆ LETOH64
Definition at line 436 of file cpu_endian.h.
◆ letoh64
Definition at line 439 of file cpu_endian.h.
◆ LOAD16BE
#define LOAD16BE | ( | p | ) |
Definition at line 186 of file cpu_endian.h.
◆ LOAD16LE
#define LOAD16LE | ( | p | ) |
Definition at line 181 of file cpu_endian.h.
◆ LOAD24BE
#define LOAD24BE | ( | p | ) |
Definition at line 197 of file cpu_endian.h.
◆ LOAD24LE
#define LOAD24LE | ( | p | ) |
Definition at line 191 of file cpu_endian.h.
◆ LOAD32BE
#define LOAD32BE | ( | p | ) |
◆ LOAD32LE
#define LOAD32LE | ( | p | ) |
◆ LOAD48BE
#define LOAD48BE | ( | p | ) |
Definition at line 226 of file cpu_endian.h.
◆ LOAD48LE
#define LOAD48LE | ( | p | ) |
Definition at line 217 of file cpu_endian.h.
◆ LOAD64BE
#define LOAD64BE | ( | p | ) |
Definition at line 246 of file cpu_endian.h.
◆ LOAD64LE
#define LOAD64LE | ( | p | ) |
Definition at line 235 of file cpu_endian.h.
◆ NTOHL
Definition at line 419 of file cpu_endian.h.
◆ ntohl
Definition at line 422 of file cpu_endian.h.
◆ NTOHLL
Definition at line 420 of file cpu_endian.h.
◆ ntohll
Definition at line 423 of file cpu_endian.h.
◆ NTOHS
Definition at line 418 of file cpu_endian.h.
◆ ntohs
Definition at line 421 of file cpu_endian.h.
◆ STORE16BE
◆ STORE16LE
◆ STORE24BE
◆ STORE24LE
◆ STORE32BE
◆ STORE32LE
◆ STORE48BE
Definition at line 302 of file cpu_endian.h.
◆ STORE48LE
Definition at line 293 of file cpu_endian.h.
◆ STORE64BE
Definition at line 322 of file cpu_endian.h.
◆ STORE64LE
Definition at line 311 of file cpu_endian.h.
◆ SWAPINT16
#define SWAPINT16 | ( | x | ) |
Definition at line 333 of file cpu_endian.h.
◆ SWAPINT32
#define SWAPINT32 | ( | x | ) |
◆ SWAPINT64
#define SWAPINT64 | ( | x | ) |
Definition at line 345 of file cpu_endian.h.
Function Documentation
◆ reverseInt16()
uint16_t reverseInt16 | ( | uint16_t | value | ) |
Reverse bit order in a 16-bit word.
- Parameters
-
[in] value 16-bit value
- Returns
- 16-bit value with bit order reversed
Definition at line 106 of file cpu_endian.c.
◆ reverseInt32()
uint32_t reverseInt32 | ( | uint32_t | value | ) |
Reverse bit order in a 32-bit word.
- Parameters
-
[in] value 32-bit value
- Returns
- 32-bit value with bit order reversed
Definition at line 123 of file cpu_endian.c.
◆ reverseInt4()
uint8_t reverseInt4 | ( | uint8_t | value | ) |
Reverse bit order in a 4-bit word.
- Parameters
-
[in] value 4-bit value
- Returns
- 4-bit value with bit order reversed
Definition at line 75 of file cpu_endian.c.
◆ reverseInt64()
uint64_t reverseInt64 | ( | uint64_t | value | ) |
Reverse bit order in a 64-bit word.
- Parameters
-
[in] value 64-bit value
- Returns
- 64-bit value with bit order reversed
Definition at line 141 of file cpu_endian.c.
◆ reverseInt8()
uint8_t reverseInt8 | ( | uint8_t | value | ) |
Reverse bit order in a byte.
- Parameters
-
[in] value 8-bit value
- Returns
- 8-bit value with bit order reversed
Definition at line 90 of file cpu_endian.c.
◆ swapInt16()
uint16_t swapInt16 | ( | uint16_t | value | ) |
Reverse the byte order of a 16-bit word.
- Parameters
-
[in] value 16-bit value
- Returns
- 16-bit value with byte order swapped
Definition at line 39 of file cpu_endian.c.
◆ swapInt32()
uint32_t swapInt32 | ( | uint32_t | value | ) |
Reverse the byte order of a 32-bit word.
- Parameters
-
[in] value 32-bit value
- Returns
- 32-bit value with byte order swapped
Definition at line 51 of file cpu_endian.c.
◆ swapInt64()
uint64_t swapInt64 | ( | uint64_t | value | ) |
Reverse the byte order of a 64-bit word.
- Parameters
-
[in] value 64-bit value
- Returns
- 64-bit value with byte order swapped
Definition at line 63 of file cpu_endian.c.