cpu_endian.c File Reference

Byte order conversion. More...

#include "cpu_endian.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.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.4

Definition in file cpu_endian.c.

Function Documentation

◆ reverseInt16()

uint16_t reverseInt16 ( uint16_t  value)

Reverse bit order in a 16-bit word.

Parameters
[in]value16-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]value32-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]value4-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]value64-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]value8-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]value16-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]value32-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]value64-bit value
Returns
64-bit value with byte order swapped

Definition at line 63 of file cpu_endian.c.