diff options
Diffstat (limited to 'lib/rbcodec/codecs/librm/bytestream.h')
-rw-r--r-- | lib/rbcodec/codecs/librm/bytestream.h | 37 |
1 files changed, 37 insertions, 0 deletions
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 @@ | |||
1 | #ifndef RM_BYTESTREAM_H | ||
2 | #define RM_BYTESTREAM_H | ||
3 | |||
4 | #include <inttypes.h> | ||
5 | |||
6 | static inline void advance_buffer(uint8_t **buf, int val) | ||
7 | { | ||
8 | *buf += val; | ||
9 | } | ||
10 | |||
11 | static inline uint8_t rm_get_uint8(uint8_t *buf) | ||
12 | { | ||
13 | return (uint8_t)buf[0]; | ||
14 | } | ||
15 | |||
16 | static inline uint16_t rm_get_uint16be(uint8_t *buf) | ||
17 | { | ||
18 | return (uint16_t)((buf[0] << 8)|buf[1]); | ||
19 | } | ||
20 | |||
21 | static inline uint32_t rm_get_uint32be(uint8_t *buf) | ||
22 | { | ||
23 | return (uint32_t)((buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]); | ||
24 | } | ||
25 | |||
26 | static inline uint16_t rm_get_uint16le(uint8_t *buf) | ||
27 | { | ||
28 | return (uint16_t)((buf[1] << 8)|buf[0]); | ||
29 | } | ||
30 | |||
31 | static inline uint32_t rm_get_uint32le(uint8_t *buf) | ||
32 | { | ||
33 | return (uint32_t)((buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]); | ||
34 | } | ||
35 | |||
36 | #endif /* RM_BYTESTREAM_H */ | ||
37 | |||