From adbdd27a950784ecca176e9107093215c6415bd7 Mon Sep 17 00:00:00 2001 From: Milanka Ringwald Date: Thu, 1 Nov 2018 09:31:40 +0100 Subject: [PATCH] btstack_util: add little_endian_store_24 --- src/btstack_util.c | 6 ++++++ src/btstack_util.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/btstack_util.c b/src/btstack_util.c index 213bf07fb..703f0627e 100644 --- a/src/btstack_util.c +++ b/src/btstack_util.c @@ -86,6 +86,12 @@ void little_endian_store_16(uint8_t *buffer, uint16_t pos, uint16_t value){ buffer[pos++] = (uint8_t)(value >> 8); } +void little_endian_store_24(uint8_t *buffer, uint16_t pos, uint32_t value){ + buffer[pos++] = (uint8_t)(value); + buffer[pos++] = (uint8_t)(value >> 8); + buffer[pos++] = (uint8_t)(value >> 16); +} + void little_endian_store_32(uint8_t *buffer, uint16_t pos, uint32_t value){ buffer[pos++] = (uint8_t)(value); buffer[pos++] = (uint8_t)(value >> 8); diff --git a/src/btstack_util.h b/src/btstack_util.h index 88646b6a8..d8aa36637 100644 --- a/src/btstack_util.h +++ b/src/btstack_util.h @@ -108,6 +108,7 @@ uint32_t little_endian_read_32(const uint8_t * buffer, int position); * @param value */ void little_endian_store_16(uint8_t *buffer, uint16_t position, uint16_t value); +void little_endian_store_24(uint8_t *buffer, uint16_t position, uint32_t value); void little_endian_store_32(uint8_t *buffer, uint16_t position, uint32_t value); /**