MCUX CLNS MCUX Crypto Library Normal Secure |

mcuxClMemory_Endianness.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------*/
2 /* Copyright 2020-2021 NXP */
3 /* */
4 /* NXP Confidential. This software is owned or controlled by NXP and may */
5 /* only be used strictly in accordance with the applicable license terms. */
6 /* By expressly accepting such terms or by downloading, installing, */
7 /* activating and/or otherwise using the software, you are agreeing that */
8 /* you have read, and that you agree to comply with and are bound by, such */
9 /* license terms. If you do not agree to be bound by the applicable license */
10 /* terms, then you may not retain, install, activate or otherwise use the */
11 /* software. */
12 /*--------------------------------------------------------------------------*/
13
26 #ifndef MCUXCLMEMORY_ENDIANNESS_H_
27 #define MCUXCLMEMORY_ENDIANNESS_H_
28
29 #include <mcuxClMemory_Types.h>
30
31
32 /**********************************************
33 * MACROS
34 **********************************************/
35
45 #define mcuxClMemory_StoreLittleEndian32( destination, value ) \
46 { \
47 (destination)[0] = (uint8_t) (((value) & 0x000000FFU) >> 0u); \
48 (destination)[1] = (uint8_t) (((value) & 0x0000FF00U) >> 8u); \
49 (destination)[2] = (uint8_t) (((value) & 0x00FF0000U) >> 16u); \
50 (destination)[3] = (uint8_t) (((value) & 0xFF000000U) >> 24u); \
51 }
52
61 #define mcuxClMemory_StoreBigEndian32( destination, value ) \
62 { \
63 (destination)[0] = (uint8_t) (((value) & 0xFF000000U) >> 24u); \
64 (destination)[1] = (uint8_t) (((value) & 0x00FF0000U) >> 16u); \
65 (destination)[2] = (uint8_t) (((value) & 0x0000FF00U) >> 8u); \
66 (destination)[3] = (uint8_t) (((value) & 0x000000FFU) >> 0u); \
67 }
68
77 #define mcuxClMemory_LoadLittleEndian32( source ) \
78 ( (((uint32_t) (source)[0]) << 0u) | \
79 (((uint32_t) (source)[1]) << 8u) | \
80 (((uint32_t) (source)[2]) << 16u) | \
81 (((uint32_t) (source)[3]) << 24u) )
82
83
91 #define mcuxClMemory_LoadBigEndian32( source ) \
92 ( (((uint32_t) (source)[0]) << 24u) | \
93 (((uint32_t) (source)[1]) << 16u) | \
94 (((uint32_t) (source)[2]) << 8u) | \
95 (((uint32_t) (source)[3]) << 0u) )
96
104 #define MCUXCLMEMORY_SWITCH_4BYTE_ENDIANNESS(input) __REV(input)
105
106 #endif /* MCUXCLMEMORY_ENDIANNESS_H_ */
107
mcuxClMemory_Types.h
Memory type header.