freetype
[Top][All Lists]
Advanced

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

Re: Use of FT_Long (= unsigned long) in psaux module


From: David Turner
Subject: Re: Use of FT_Long (= unsigned long) in psaux module
Date: Wed, 11 Oct 2000 17:24:38 +0200

Hi Tom,

> 
> (FT_Long)(a << 24) | (FT_Long)(b << 16) | (FT_Long)(c << 8) | d
> 
> a, b, c, and d  are unsigned quantities.  Shifting an unsigned quantity
> left 24 bits and then casting it to FT_Long does not set the sign bit
> in the result, even if the sign bit is set (that is, 0x80 & quantity != 0)
> in the quantity being shifted.
> 
> This has to to with Type 1 charstring numbers encoded as FF X X X X.
> 

I just commited a fix to "psaux", the decoding now looks like

  value = (FT_Int32)( ((FT_Long)a << 24) |
                      ((FT_Long)b << 16) |
                      ((FT_Long)c <<  8) | d );

which should work even with the Compaq compiler. Let me know if this
is incorrect.

Again, thanks for your valuable comments and bugs !!

Regards,

- David

> 
> > There are cases it may occurs (when the specs are specifying the way 
> > overflow
> > are to be handled), and in those cases, a masking operation of 0xFFFFFFFF on
> > the result is required, but *first* this should not be allowed on _signed_
> > operations, but rather an _unsigned_ one. However, I did not remember of 
> > this
> > case about 32 bits quantities, but rather about 16 bits ones.
> >
> > Can you be more precise with the problem you see?
> >
> 
> See above...
> 
> Tom



reply via email to

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