1999-12-17 00:11:37 +01:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* ftcalc.h */
|
|
|
|
/* */
|
|
|
|
/* Arithmetic computations (specification). */
|
|
|
|
/* */
|
2000-01-02 10:41:30 +01:00
|
|
|
/* Copyright 1996-2000 by */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
|
|
|
/* */
|
2000-07-18 08:50:03 +02:00
|
|
|
/* This file is part of the FreeType project, and may only be used, */
|
|
|
|
/* modified, and distributed under the terms of the FreeType project */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
|
|
|
/* this file you indicate that you have read the license and */
|
|
|
|
/* understand and accept it fully. */
|
|
|
|
/* */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef FTCALC_H
|
|
|
|
#define FTCALC_H
|
|
|
|
|
2000-05-11 20:23:52 +02:00
|
|
|
#include <freetype/freetype.h>
|
2000-07-27 00:51:03 +02:00
|
|
|
#include <freetype/config/ftconfig.h> /* for FT_LONG64 */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2000-07-27 00:29:22 +02:00
|
|
|
#ifdef FT_LONG64
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-01-02 10:41:30 +01:00
|
|
|
|
2000-07-27 00:29:22 +02:00
|
|
|
typedef FT_INT64 FT_Int64;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
#define ADD_64( x, y, z ) z = (x) + (y)
|
|
|
|
#define MUL_64( x, y, z ) z = (FT_Int64)(x) * (y)
|
2000-09-12 00:50:13 +02:00
|
|
|
#define DIV_64( x, y ) ( (x) / (y) )
|
2000-07-18 08:50:03 +02:00
|
|
|
|
2000-05-02 12:52:28 +02:00
|
|
|
#ifdef FT_CONFIG_OPTION_OLD_CALCS
|
|
|
|
|
|
|
|
#define SQRT_64( z ) FT_Sqrt64( z )
|
|
|
|
|
2000-06-02 23:31:32 +02:00
|
|
|
FT_EXPORT_DEF( FT_Int32 ) FT_Sqrt64( FT_Int64 l );
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
#endif /* FT_CONFIG_OPTION_OLD_CALCS */
|
2000-05-02 12:52:28 +02:00
|
|
|
|
2000-07-18 08:50:03 +02:00
|
|
|
|
2000-07-27 00:51:03 +02:00
|
|
|
#else /* FT_LONG64 */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-02 23:31:32 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
typedef struct FT_Int64_
|
|
|
|
{
|
2000-07-05 06:32:02 +02:00
|
|
|
FT_UInt32 lo;
|
|
|
|
FT_UInt32 hi;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
} FT_Int64;
|
|
|
|
|
2000-07-18 08:50:03 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
#define ADD_64( x, y, z ) FT_Add64( &x, &y, &z )
|
|
|
|
#define MUL_64( x, y, z ) FT_MulTo64( x, y, &z )
|
|
|
|
#define DIV_64( x, y ) FT_Div64by32( &x, y )
|
|
|
|
|
2000-07-18 08:50:03 +02:00
|
|
|
FT_EXPORT_DEF( void ) FT_Add64( FT_Int64* x,
|
|
|
|
FT_Int64* y,
|
|
|
|
FT_Int64* z );
|
|
|
|
|
|
|
|
FT_EXPORT_DEF( void ) FT_MulTo64( FT_Int32 x,
|
|
|
|
FT_Int32 y,
|
|
|
|
FT_Int64* z );
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-02 23:31:32 +02:00
|
|
|
FT_EXPORT_DEF( FT_Int32 ) FT_Div64by32( FT_Int64* x,
|
|
|
|
FT_Int32 y );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-07-18 08:50:03 +02:00
|
|
|
|
2000-05-02 12:52:28 +02:00
|
|
|
#ifdef FT_CONFIG_OPTION_OLD_CALCS
|
|
|
|
|
2000-09-12 00:50:13 +02:00
|
|
|
FT_EXPORT_DEF( FT_Int32 ) FT_SqrtFixed( FT_Int32 x );
|
2000-09-02 02:20:42 +02:00
|
|
|
|
2000-05-02 12:52:28 +02:00
|
|
|
#define SQRT_64( z ) FT_Sqrt64( &z )
|
|
|
|
|
2000-06-02 23:31:32 +02:00
|
|
|
FT_EXPORT_DEF( FT_Int32 ) FT_Sqrt64( FT_Int64* x );
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-07-18 08:50:03 +02:00
|
|
|
#endif /* FT_CONFIG_OPTION_OLD_CALCS */
|
|
|
|
|
2000-01-02 10:41:30 +01:00
|
|
|
|
2000-07-27 00:51:03 +02:00
|
|
|
#endif /* FT_LONG64 */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-01-02 10:41:30 +01:00
|
|
|
|
2000-05-02 12:52:28 +02:00
|
|
|
#ifndef FT_CONFIG_OPTION_OLD_CALCS
|
|
|
|
|
2000-06-02 23:31:32 +02:00
|
|
|
#define SQRT_32( x ) FT_Sqrt32( x )
|
|
|
|
|
2000-07-18 08:50:03 +02:00
|
|
|
BASE_DEF( FT_Int32 ) FT_Sqrt32( FT_Int32 x );
|
2000-06-02 23:31:32 +02:00
|
|
|
|
2000-07-18 08:50:03 +02:00
|
|
|
#endif /* !FT_CONFIG_OPTION_OLD_CALCS */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* FT_MulDiv() and FT_MulFix() are declared in freetype.h. */
|
|
|
|
/* */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) << 6 )
|
|
|
|
#define INT_TO_F2DOT14( x ) ( (FT_Long)(x) << 14 )
|
|
|
|
#define INT_TO_FIXED( x ) ( (FT_Long)(x) << 16 )
|
|
|
|
#define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) << 2 )
|
2000-07-18 08:50:03 +02:00
|
|
|
#define FLOAT_TO_FIXED( x ) ( (FT_Long)( x * 65536.0 ) )
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-02 23:31:32 +02:00
|
|
|
#define ROUND_F26DOT6( x ) ( x >= 0 ? ( ( (x) + 32 ) & -64 ) \
|
|
|
|
: ( -( ( 32 - (x) ) & -64 ) ) )
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-07-18 08:50:03 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* FTCALC_H */
|
|
|
|
|
|
|
|
|
|
|
|
/* END */
|