freetype-devel
[Top][All Lists]
Advanced

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

[ft-devel] Discrepancy in FT_MulFix macros and int sizes


From: Behdad Esfahbod
Subject: [ft-devel] Discrepancy in FT_MulFix macros and int sizes
Date: Tue, 18 Nov 2014 18:05:10 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

Hi,

It was reported to me by my colleague Doug Felt (CC'ed) that FT_MulFix takes
FT_Long parameters as defined in freetype.h, but several inline
implementations of it in ftcalc.h take FT_Int32 arguments.  I imagine this
might have historical reasons, but it's something that would be good to address.

Regardless of the history, this is causing compile warnings on x86-64 when
parameters of type FT_Fixed (=FT_Long) are passed to this function when the
inline implementations are used, as integer values are truncated from 64bit to
32bit.  Perhaps a patch like this (untested):

diff --git a/include/internal/ftcalc.h b/include/internal/ftcalc.h
index d4023fa..1a98a8f 100644
--- a/include/internal/ftcalc.h
+++ b/include/internal/ftcalc.h
@@ -241,7 +241,7 @@ FT_BEGIN_HEADER

 #ifdef FT_CONFIG_OPTION_INLINE_MULFIX
 #ifdef FT_MULFIX_ASSEMBLER
-#define FT_MulFix( a, b )  FT_MULFIX_ASSEMBLER( a, b )
+#define FT_MulFix( a, b )  FT_MULFIX_ASSEMBLER( (FT_Int32)(a), (FT_Int32)(b) )
 #endif
 #endif

Thanks
-- 
behdad
http://behdad.org/



reply via email to

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