Revision a3550abd libavutil/intreadwrite.h

View differences:

libavutil/intreadwrite.h
26 26
#endif /* !__GNUC__ */
27 27

  
28 28
/* endian macros */
29
#if !defined(AV_RB16) || !defined(AV_RB32) || !defined(AV_RL16) || !defined(AV_RL32)
30
#define AV_RB16(x)  ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
31
#define AV_RB32(x)  ((((uint8_t*)(x))[0] << 24) | \
29
#define AV_RB8(x)  (((uint8_t*)(x))[0])
30
#define AV_WB8(p, i, d)  { ((uint8_t*)(p))[(i)] = (d); }
31

  
32
#define AV_RB16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
33
#define AV_WB16(p, i, d) { \
34
                    ((uint8_t*)(p))[(i)+1] = (d); \
35
                    ((uint8_t*)(p))[(i)] = (d)>>8; }
36

  
37
#define AV_RB32(x) ((((uint8_t*)(x))[0] << 24) | \
32 38
                   (((uint8_t*)(x))[1] << 16) | \
33 39
                   (((uint8_t*)(x))[2] << 8) | \
34 40
                    ((uint8_t*)(x))[3])
35
#define AV_RL16(x)  ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0])
36
#define AV_RL32(x)  ((((uint8_t*)(x))[3] << 24) | \
41
#define AV_WB32(p, i, d) { \
42
                    ((uint8_t*)(p))[(i)+3] = (d); \
43
                    ((uint8_t*)(p))[(i)+2] = (d)>>8; \
44
                    ((uint8_t*)(p))[(i)+1] = (d)>>16; \
45
                    ((uint8_t*)(p))[(i)] = (d)>>24; }
46

  
47
#define AV_RL8(x)  AV_RB8(x)
48
#define AV_WL8(p, i, d)  AV_WB8(p, i, d)
49

  
50
#define AV_RL16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0])
51
#define AV_WL16(p, i, d) { \
52
                    ((uint8_t*)(p))[(i)] = (d); \
53
                    ((uint8_t*)(p))[(i)+1] = (d)>>8; }
54

  
55
#define AV_RL32(x) ((((uint8_t*)(x))[3] << 24) | \
37 56
                   (((uint8_t*)(x))[2] << 16) | \
38 57
                   (((uint8_t*)(x))[1] << 8) | \
39 58
                    ((uint8_t*)(x))[0])
40
#endif
59
#define AV_WL32(p, i, d) { \
60
                    ((uint8_t*)(p))[(i)] = (d); \
61
                    ((uint8_t*)(p))[(i)+1] = (d)>>8; \
62
                    ((uint8_t*)(p))[(i)+2] = (d)>>16; \
63
                    ((uint8_t*)(p))[(i)+3] = (d)>>24; }
41 64

  
42 65
#endif /* INTREADWRITE_H */

Also available in: Unified diff