Mercurial > libavutil.hg
comparison mips/intreadwrite.h @ 812:f849545df4e5 libavutil
Mark all intreadwrite functions av_always_inline
author | mru |
---|---|
date | Mon, 18 Jan 2010 01:35:19 +0000 |
parents | 27154cd3d95b |
children |
comparison
equal
deleted
inserted
replaced
811:c08dd82b122e | 812:f849545df4e5 |
---|---|
23 | 23 |
24 #include <stdint.h> | 24 #include <stdint.h> |
25 #include "config.h" | 25 #include "config.h" |
26 | 26 |
27 #define AV_RN32 AV_RN32 | 27 #define AV_RN32 AV_RN32 |
28 static inline uint32_t AV_RN32(const void *p) | 28 static av_always_inline uint32_t AV_RN32(const void *p) |
29 { | 29 { |
30 uint32_t v; | 30 uint32_t v; |
31 __asm__ ("lwl %0, %1 \n\t" | 31 __asm__ ("lwl %0, %1 \n\t" |
32 "lwr %0, %2 \n\t" | 32 "lwr %0, %2 \n\t" |
33 : "=&r"(v) | 33 : "=&r"(v) |
35 "m"(*(const uint32_t *)((const uint8_t *)p+3*HAVE_BIGENDIAN))); | 35 "m"(*(const uint32_t *)((const uint8_t *)p+3*HAVE_BIGENDIAN))); |
36 return v; | 36 return v; |
37 } | 37 } |
38 | 38 |
39 #define AV_WN32 AV_WN32 | 39 #define AV_WN32 AV_WN32 |
40 static inline void AV_WN32(void *p, uint32_t v) | 40 static av_always_inline void AV_WN32(void *p, uint32_t v) |
41 { | 41 { |
42 __asm__ ("swl %2, %0 \n\t" | 42 __asm__ ("swl %2, %0 \n\t" |
43 "swr %2, %1 \n\t" | 43 "swr %2, %1 \n\t" |
44 : "=m"(*(uint32_t *)((uint8_t *)p+3*!HAVE_BIGENDIAN)), | 44 : "=m"(*(uint32_t *)((uint8_t *)p+3*!HAVE_BIGENDIAN)), |
45 "=m"(*(uint32_t *)((uint8_t *)p+3*HAVE_BIGENDIAN)) | 45 "=m"(*(uint32_t *)((uint8_t *)p+3*HAVE_BIGENDIAN)) |
47 } | 47 } |
48 | 48 |
49 #if ARCH_MIPS64 | 49 #if ARCH_MIPS64 |
50 | 50 |
51 #define AV_RN64 AV_RN64 | 51 #define AV_RN64 AV_RN64 |
52 static inline uint64_t AV_RN64(const void *p) | 52 static av_always_inline uint64_t AV_RN64(const void *p) |
53 { | 53 { |
54 uint64_t v; | 54 uint64_t v; |
55 __asm__ ("ldl %0, %1 \n\t" | 55 __asm__ ("ldl %0, %1 \n\t" |
56 "ldr %0, %2 \n\t" | 56 "ldr %0, %2 \n\t" |
57 : "=&r"(v) | 57 : "=&r"(v) |
59 "m"(*(const uint64_t *)((const uint8_t *)p+7*HAVE_BIGENDIAN))); | 59 "m"(*(const uint64_t *)((const uint8_t *)p+7*HAVE_BIGENDIAN))); |
60 return v; | 60 return v; |
61 } | 61 } |
62 | 62 |
63 #define AV_WN64 AV_WN64 | 63 #define AV_WN64 AV_WN64 |
64 static inline void AV_WN64(void *p, uint64_t v) | 64 static av_always_inline void AV_WN64(void *p, uint64_t v) |
65 { | 65 { |
66 __asm__ ("sdl %2, %0 \n\t" | 66 __asm__ ("sdl %2, %0 \n\t" |
67 "sdr %2, %1 \n\t" | 67 "sdr %2, %1 \n\t" |
68 : "=m"(*(uint64_t *)((uint8_t *)p+7*!HAVE_BIGENDIAN)), | 68 : "=m"(*(uint64_t *)((uint8_t *)p+7*!HAVE_BIGENDIAN)), |
69 "=m"(*(uint64_t *)((uint8_t *)p+7*HAVE_BIGENDIAN)) | 69 "=m"(*(uint64_t *)((uint8_t *)p+7*HAVE_BIGENDIAN)) |
71 } | 71 } |
72 | 72 |
73 #else | 73 #else |
74 | 74 |
75 #define AV_RN64 AV_RN64 | 75 #define AV_RN64 AV_RN64 |
76 static inline uint64_t AV_RN64(const void *p) | 76 static av_always_inline uint64_t AV_RN64(const void *p) |
77 { | 77 { |
78 union { uint64_t v; uint32_t hl[2]; } v; | 78 union { uint64_t v; uint32_t hl[2]; } v; |
79 v.hl[0] = AV_RN32(p); | 79 v.hl[0] = AV_RN32(p); |
80 v.hl[1] = AV_RN32((const uint8_t *)p + 4); | 80 v.hl[1] = AV_RN32((const uint8_t *)p + 4); |
81 return v.v; | 81 return v.v; |
82 } | 82 } |
83 | 83 |
84 #define AV_WN64 AV_WN64 | 84 #define AV_WN64 AV_WN64 |
85 static inline void AV_WN64(void *p, uint64_t v) | 85 static av_always_inline void AV_WN64(void *p, uint64_t v) |
86 { | 86 { |
87 union { uint64_t v; uint32_t hl[2]; } vv = { v }; | 87 union { uint64_t v; uint32_t hl[2]; } vv = { v }; |
88 AV_WN32(p, vv.hl[0]); | 88 AV_WN32(p, vv.hl[0]); |
89 AV_WN32((uint8_t *)p + 4, vv.hl[1]); | 89 AV_WN32((uint8_t *)p + 4, vv.hl[1]); |
90 } | 90 } |