freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Freetype] 40-bit longs


From: Darren J Longhorn
Subject: Re: [Freetype] 40-bit longs
Date: Thu, 3 Jun 2004 00:35:55 +0100

> > I'm contemplating a port to the TI DM642 DSP.  One issue that's sure
> > to crop up is the size of longs on this platform.  ULONG_MAX is
> > 1099511627775, but sizeof returns 8 due to alignment issues. [...]
> 
> Weird.

Yeah, it surprised me a bit when I first saw it. 

> > Does anyone have any recommendation on how to tackle this issue?  I
> > thought I might try forcing both ints and longs to be 32 bit.
> > Anyone foresee any problems with this?
> 
> This sounds good.  You might add code to ftconfig.h; currently we have
> 
>     /* The size of an `long' type.  */
>   #if   FT_ULONG_MAX == 0xFFFFFFFFUL
>   #define FT_SIZEOF_LONG  (32 / FT_CHAR_BIT)
>   #elif FT_ULONG_MAX == 0xFFFFU
>   #define FT_SIZEOF_LONG  (16 / FT_CHAR_BIT)
>   #elif FT_ULONG_MAX > 0xFFFFFFFFU && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFU
>   #define FT_SIZEOF_LONG  (64 / FT_CHAR_BIT)
>   #else
>   #error "Unsupported size of `long' type!"
> 
> and similar code for `int'.  It should be straightforward to handle
> your case where FT_LONG_MAX is 0xFFFFFFFFFF, forcing FT_SIZEOF_LONG to
> represent 32bit values.
 
That would seem to be the place to handle it.

> I believe that I've removed all code which expects integer overflow,

That's reassuring.

> and that I've added proper range checks everywhere.  Please provide
> patches in case you encounter difficulties.

Will do.
 
> BTW, you should use the CVS version; after the 2.1.8 release I've
> checked in some more code converted to use FT_CHAR_BIT.

OK.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]