blob: c6172e101bc23cf298c906e2e7bf44a930139c54 [file] [log] [blame]
Julian Hall201ce462021-04-29 11:05:34 +01001/*
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
14extern "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 */
23uint8_t load_u8_le(const void *base, size_t offset);
24uint16_t load_u16_le(const void *base, size_t offset);
25uint32_t load_u32_le(const void *base, size_t offset);
26uint64_t load_u64_le(const void *base, size_t offset);
27
28void store_u8_le(void *base, size_t offset, uint8_t val);
29void store_u16_le(void *base, size_t offset, uint16_t val);
30void store_u32_le(void *base, size_t offset, uint32_t val);
31void store_u64_le(void *base, size_t offset, uint64_t val);
32
33#ifdef __cplusplus
34}
35#endif
36
37#endif /* ENDIAN_LE_H */