Loading...
Searching...
No Matches
bytes_le.h
Go to the documentation of this file.
1
12#pragma once
13#include <stdint.h>
14
19
26static inline int16_t read_i16_le(const uint8_t *p)
27{
28 return (int16_t)(p[0] | (p[1] << 8));
29}
30
37static inline int32_t read_i32_le(const uint8_t *p)
38{
39 return (int32_t)((uint32_t)p[0] | ((uint32_t)p[1] << 8) | ((uint32_t)p[2] << 16) | ((uint32_t)p[3] << 24));
40}
41
static int16_t read_i16_le(const uint8_t *p)
Reads a little-endian signed 16-bit value out of a byte pair.
Definition bytes_le.h:26
static int32_t read_i32_le(const uint8_t *p)
Reads a little-endian signed 32-bit value out of four bytes.
Definition bytes_le.h:37