History

bytestream: Eliminate one level of pointless macro indirection.

Diego Biurrun committed 14 years ago

Commit f03183d1 parent abe3c691 file · +11 −19Browse files

Unified · Split

libavcodec/bytestream.h+11−19
@@ -23,6 +23,7 @@ · 22 unmodified lines
23#ifndef AVCODEC_BYTESTREAM_H23#ifndef AVCODEC_BYTESTREAM_H
24#define AVCODEC_BYTESTREAM_H24#define AVCODEC_BYTESTREAM_H
25 25
26#include <stdint.h>
26#include <string.h>27#include <string.h>
27 28
28#include "libavutil/common.h"29#include "libavutil/common.h"
@@ -37,7 +38,7 @@ typedef struct { · 8 unmodified lines
37 int eof;38 int eof;
38} PutByteContext;39} PutByteContext;
39 40
40#define DEF_T(type, name, bytes, read, write) \41#define DEF(type, name, bytes, read, write) \
41static av_always_inline type bytestream_get_ ## name(const uint8_t **b) \42static av_always_inline type bytestream_get_ ## name(const uint8_t **b) \
42{ \43{ \
43 (*b) += bytes; \44 (*b) += bytes; \
@@ -80,24 +81,15 @@ static av_always_inline type bytestream2_peek_ ## name(GetByteContext *g) \ · 36 unmodified lines
80 return read(g->buffer); \81 return read(g->buffer); \
81}82}
82 83
83#define DEF(name, bytes, read, write) \84DEF(uint64_t, le64, 8, AV_RL64, AV_WL64)
84 DEF_T(unsigned int, name, bytes, read, write)85DEF(unsigned int, le32, 4, AV_RL32, AV_WL32)
85#define DEF64(name, bytes, read, write) \86DEF(unsigned int, le24, 3, AV_RL24, AV_WL24)
86 DEF_T(uint64_t, name, bytes, read, write)87DEF(unsigned int, le16, 2, AV_RL16, AV_WL16)
87 88DEF(uint64_t, be64, 8, AV_RB64, AV_WB64)
88DEF64(le64, 8, AV_RL64, AV_WL64)89DEF(unsigned int, be32, 4, AV_RB32, AV_WB32)
89DEF (le32, 4, AV_RL32, AV_WL32)90DEF(unsigned int, be24, 3, AV_RB24, AV_WB24)
90DEF (le24, 3, AV_RL24, AV_WL24)91DEF(unsigned int, be16, 2, AV_RB16, AV_WB16)
91DEF (le16, 2, AV_RL16, AV_WL16)92DEF(unsigned int, byte, 1, AV_RB8 , AV_WB8)
92DEF64(be64, 8, AV_RB64, AV_WB64)
93DEF (be32, 4, AV_RB32, AV_WB32)
94DEF (be24, 3, AV_RB24, AV_WB24)
95DEF (be16, 2, AV_RB16, AV_WB16)
96DEF (byte, 1, AV_RB8 , AV_WB8 )
97
98#undef DEF
99#undef DEF64
100#undef DEF_T
101 93
102#if HAVE_BIGENDIAN94#if HAVE_BIGENDIAN
103# define bytestream2_get_ne16 bytestream2_get_be1695# define bytestream2_get_ne16 bytestream2_get_be16

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t