From f40bfc9267b13b54e6379dfe7539447662879d24 Mon Sep 17 00:00:00 2001 From: Sean Bartell Date: Sat, 25 Jun 2011 21:32:25 -0400 Subject: Add codecs to librbcodec. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id7f4717d51ed02d67cb9f9cb3c0ada4a81843f97 Reviewed-on: http://gerrit.rockbox.org/137 Reviewed-by: Nils Wallménius Tested-by: Nils Wallménius --- lib/rbcodec/codecs/librm/bytestream.h | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 lib/rbcodec/codecs/librm/bytestream.h (limited to 'lib/rbcodec/codecs/librm/bytestream.h') diff --git a/lib/rbcodec/codecs/librm/bytestream.h b/lib/rbcodec/codecs/librm/bytestream.h new file mode 100644 index 0000000000..c2a968a4bd --- /dev/null +++ b/lib/rbcodec/codecs/librm/bytestream.h @@ -0,0 +1,37 @@ +#ifndef RM_BYTESTREAM_H +#define RM_BYTESTREAM_H + +#include + +static inline void advance_buffer(uint8_t **buf, int val) +{ + *buf += val; +} + +static inline uint8_t rm_get_uint8(uint8_t *buf) +{ + return (uint8_t)buf[0]; +} + +static inline uint16_t rm_get_uint16be(uint8_t *buf) +{ + return (uint16_t)((buf[0] << 8)|buf[1]); +} + +static inline uint32_t rm_get_uint32be(uint8_t *buf) +{ + return (uint32_t)((buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]); +} + +static inline uint16_t rm_get_uint16le(uint8_t *buf) +{ + return (uint16_t)((buf[1] << 8)|buf[0]); +} + +static inline uint32_t rm_get_uint32le(uint8_t *buf) +{ + return (uint32_t)((buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]); +} + +#endif /* RM_BYTESTREAM_H */ + -- cgit v1.2.3