[Ffmpeg-devel] gcc4 support & MMX fixups (from Debian) (original) (raw)

Måns Rullgård mru
Thu Feb 2 12:12:09 CET 2006


Pawel Sikora said:

On Thu, 2 Feb 2006, Michael Niedermayer wrote:

Hi

On Thu, Feb 02, 2006 at 09:41:37AM +0100, Pawe? Sikora wrote:

I suggest we should use a sizet type for params like *stride to avoid (on x86-64) unneeded 32<->64 conversions.

no, sizet is unsigned, stride must be signed! Right, I think offt from sys/types.h is a good candidate. It's signed, on x86-32 has 32 bits, on x86-64 has 64 bits. NO! -- Data Type: offt This is an arithmetic data type used to represent file sizes. In the GNU system, this is equivalent to fpost' or long int'. If the source is compiled with FILEOFFSETBITS == 64' this type_ _is transparently replaced by off64t'. Ok, last attempt - ptrdifft. C and C++ define a special type for pointer arithmetic, namely ptrdifft, which is a typedef of a platform-specific signed integral type. You can use a variable of type ptrdifft to store the result of subtracting and adding pointers.

The int_fastXX_t types were invented for exactly this type of situations. Specifically, int_fast32_t is 32 bits on 32-bit x86 and 64 bits on x86_64.

Using ptrdiff_t for anything other than things involving pointers is bad. There could theoretically exist a machine with 64-bit longs and 32-bit pointers. On one of these, ptrdiff_t could legally be 32 bits, and result in the same suboptimal code we wanted to avoid.

-- M?ns Rullg?rd mru at inprovide.com



More information about the ffmpeg-devel mailing list