1 /* 2 * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef ENDIAN_LE_H 8 #define ENDIAN_LE_H 9 10 #include <stddef.h> 11 #include <stdint.h> 12 13 #ifdef __cplusplus 14 extern "C" { 15 #endif 16 17 /* 18 * Functions for loading and storing integer values as unaligned 19 * values in Little Endian byte order. The address to load or 20 * store the value is specified by a base address and an offset 21 * to facilitate unaligned structure access. 22 */ 23 uint8_t load_u8_le(const void *base, size_t offset); 24 uint16_t load_u16_le(const void *base, size_t offset); 25 uint32_t load_u32_le(const void *base, size_t offset); 26 uint64_t load_u64_le(const void *base, size_t offset); 27 28 void store_u8_le(void *base, size_t offset, uint8_t val); 29 void store_u16_le(void *base, size_t offset, uint16_t val); 30 void store_u32_le(void *base, size_t offset, uint32_t val); 31 void store_u64_le(void *base, size_t offset, uint64_t val); 32 33 #ifdef __cplusplus 34 } 35 #endif 36 37 #endif /* ENDIAN_LE_H */ 38