[FFmpeg-devel] [PATCH] Make img_tags fall into .rodata
Diego 'Flameeyes' Pettenò
Fri May 2 19:48:35 CEST 2008
Michael Niedermayer <michaelni at gmx.at> writes:
> Why would we want it to be a power of 2?
Access to the N-th element of an array for the compiler is
*(&array + N*sizeof(array))
when N is a power of 2, it would just be a shift to the right, rather
than a multiplication. On every architecture I know a bit of, shift to
right is faster than multiplication.
Of course if the compiler is good enough it would know it's iterating
sequentially and just use a temporary pointer and sum sizeof(array)
in it, but it's not bad to help out not-so-smart compilers, I didn't do
the math actually, but I'd say _if_ it wastes space on 32-bit
architectures, it's a very limited waste, which might actually help.
Diego "Flameeyes" Petten?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 196 bytes
Desc: not available
More information about the ffmpeg-devel