freetype
[Top][All Lists]
Advanced

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

Re: [Freetype] 40-bit longs


From: Werner LEMBERG
Subject: Re: [Freetype] 40-bit longs
Date: Wed, 02 Jun 2004 23:05:01 +0200 (CEST)

> 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.

> 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.

I believe that I've removed all code which expects integer overflow,
and that I've added proper range checks everywhere.  Please provide
patches in case you encounter difficulties.

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.


    Werner



reply via email to

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