[XviD-devel] ia64-Patch
Christoph Lampert
xvid-devel@xvid.org
Sat, 25 Jan 2003 18:42:46 +0100 (CET)
On Sat, 25 Jan 2003, Stephan Krause wrote:
> Hi,
>
> after a longer time i checked the code for ia64 compatibility, and it did
> segfault in mbcoding. Reason was a uint32 which became -1. On 32bit-Platforms
> this is not a Problem, but on ia64 this isn't a really good idea. Using ptr_t
> instead of uint32 does help (on x86, ptr_t is just the same as uint32_t)
Yes, we should really take more care about correct types, in particular
with "64bit for everybody" around the corner:
My suggestion:
* Use "natural" types where possible. Use "int" instead of int32_t, etc.,
unless the size matters (which it almost never does). The _size_ of
structures doesn't have to be the same on every plattform...
* Of course, things like "uint8_t" for 8bit images and "int16_t" for
DCT data must be the same, but e.g. length of MV entries doesn't have
to. I doubt that XVID will ever run successfully on a machine with
16bit integers, so range should always be sufficient...
* Use unsigned int for loop counters (I read somewhere that it's
faster), unless they become negative, of course.
* When in doubt, use signed types (in particular SAD-values, MVs)
* For status values, used signed types (speed doesn't matter there, and
often negative values are useful to indicate errors.
* Use _signed_ for stride values, they are a "relative" value and might
become negative.
* For hacks which use bit-patterns etc. to speed up calculation, use
"sizeof()", or define plattform dependent macros in portab.h
Better ideas?
gruel