[FFmpeg-devel] [PATCH] Make HAVE_FAST_UNALIGNED allow unaligned memory accesses
Måns Rullgård
mans
Fri Jul 18 03:22:55 CEST 2008
Michael Niedermayer <michaelni at gmx.at> writes:
> On Tue, Jul 15, 2008 at 08:16:21PM +0100, Mans Rullgard wrote:
>> If HAVE_FAST_UNALIGNED is defined, potentially unaligned data is
>> accessed through normal pointers. Otherwise, compiler-specific
>> code is used to perform unaligned accesses, falling back to
>> byte-wise access if no compiler support is available.
>> ---
>> libavutil/intreadwrite.h | 130 +++++++++++++++++++++++++++------------------
>> 1 files changed, 78 insertions(+), 52 deletions(-)
>
> [...]
>
>> @@ -37,7 +39,19 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed));
>> #define AV_WN32(a, b) (((struct unaligned_32 *) (a))->l) = (b)
>> #define AV_WN64(a, b) (((struct unaligned_64 *) (a))->l) = (b)
>>
>> +#elif defined(__DECC)
>> +
>> +#define AV_RN16(a) (*((const __unaligned uint16_t*)(a)))
>> +#define AV_RN32(a) (*((const __unaligned uint32_t*)(a)))
>> +#define AV_RN64(a) (*((const __unaligned uint64_t*)(a)))
>> +
>> +#define AV_WN16(a, b) *((__unaligned uint16_t*)(a)) = (b)
>> +#define AV_WN32(a, b) *((__unaligned uint32_t*)(a)) = (b)
>> +#define AV_WN64(a, b) *((__unaligned uint64_t*)(a)) = (b)
>
> This change is ok, as a seperate commit (note ive edit it, the removial
> of #else on its own would break the code).
Done.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list