#ifndef STEMSEP_BYTES_H #define STEMSEP_BYTES_H #include static inline uint16_t read_u16_le(const uint8_t *bytes) { return (uint16_t)((uint16_t)bytes[0] | ((uint16_t)bytes[1] << 8U)); } static inline uint32_t read_u32_le(const uint8_t *bytes) { return (uint32_t)bytes[0] | ((uint32_t)bytes[1] << 8U) | ((uint32_t)bytes[2] << 16U) | ((uint32_t)bytes[3] << 24U); } static inline void store_u16_le(uint8_t *bytes, uint16_t value) { bytes[0] = (uint8_t)value; bytes[1] = (uint8_t)(value >> 8U); } static inline void store_u32_le(uint8_t *bytes, uint32_t value) { bytes[0] = (uint8_t)value; bytes[1] = (uint8_t)(value >> 8U); bytes[2] = (uint8_t)(value >> 16U); bytes[3] = (uint8_t)(value >> 24U); } #endif