Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4680 right-hear 1
/*******************************************************************
2
 *
3
 *  ttcalc.h
4
 *
5
 *    Arithmetic Computations (specification).
6
 *
7
 *  Copyright 1996-1999 by
8
 *  David Turner, Robert Wilhelm, and Werner Lemberg.
9
 *
10
 *  This file is part of the FreeType project, and may only be used
11
 *  modified and distributed under the terms of the FreeType project
12
 *  license, LICENSE.TXT.  By continuing to use, modify, or distribute
13
 *  this file you indicate that you have read the license and
14
 *  understand and accept it fully.
15
 *
16
 ******************************************************************/
17
 
18
#ifndef TTCALC_H
19
#define TTCALC_H
20
 
21
#include "ttconfig.h"
22
#include "freetype.h"
23
 
24
 
25
#ifdef __cplusplus
26
  extern "C" {
27
#endif
28
 
29
#ifdef LONG64
30
 
31
  typedef INT64  TT_Int64;
32
 
33
#define ADD_64( x, y, z )  z = x + y
34
#define SUB_64( x, y, z )  z = x - y
35
#define MUL_64( x, y, z )  z = (TT_Int64)(x) * (y)
36
 
37
#define DIV_64( x, y )     ( (x) / (y) )
38
 
39
#define SQRT_64( x )       Sqrt64( x )
40
#define SQRT_32( x )       Sqrt32( x )
41
 
42
  LOCAL_DEF TT_Int32  Sqrt64( TT_Int64  l );
43
 
44
#else /* LONG64 */
45
 
46
  struct  TT_Int64_
47
  {
48
    TT_Word32  lo;
49
    TT_Word32  hi;
50
  };
51
 
52
  typedef struct TT_Int64_  TT_Int64;
53
 
54
#define ADD_64( x, y, z )  Add64( &x, &y, &z )
55
#define SUB_64( x, y, z )  Sub64( &x, &y, &z )
56
#define MUL_64( x, y, z )  MulTo64( x, y, &z )
57
 
58
#define DIV_64( x, y )     Div64by32( &x, y )
59
 
60
#define SQRT_64( x )       Sqrt64( &x )
61
#define SQRT_32( x )       Sqrt32( x )
62
 
63
  LOCAL_DEF void  Add64( TT_Int64*  x, TT_Int64*  y, TT_Int64*  z );
64
  LOCAL_DEF void  Sub64( TT_Int64*  x, TT_Int64*  y, TT_Int64*  z );
65
 
66
  LOCAL_DEF void  MulTo64( TT_Int32  x, TT_Int32  y, TT_Int64*  z );
67
 
68
  LOCAL_DEF TT_Int32  Div64by32( TT_Int64*  x, TT_Int32  y );
69
 
70
  LOCAL_DEF int  Order64( TT_Int64*  z );
71
 
72
  LOCAL_DEF TT_Int32  Sqrt64( TT_Int64*  l );
73
 
74
#endif /* LONG64 */
75
 
76
  /* The two following functions are now part of the API!          */
77
 
78
  /* TT_Long  TT_MulDiv( TT_Long  a, TT_Long  b, TT_Long  c );     */
79
  /* TT_Long  TT_MulFix( TT_Long  a, TT_Long  b );                 */
80
 
81
 
82
#define INT_TO_F26DOT6( x )    ( (Long)(x) << 6  )
83
#define INT_TO_F2DOT14( x )    ( (Long)(x) << 14 )
84
#define INT_TO_FIXED( x )      ( (Long)(x) << 16 )
85
#define F2DOT14_TO_FIXED( x )  ( (Long)(x) << 2  )
86
#define FLOAT_TO_FIXED( x )    ( (Long)(x * 65536.0) )
87
 
88
#define ROUND_F26DOT6( x )     ( x >= 0 ? (   ((x) + 32) & -64) \
89
                                        : ( -((32 - (x)) & -64) ) )
90
 
91
#ifdef __cplusplus
92
  }
93
#endif
94
 
95
#endif /* TTCALC_H */
96
 
97
/* END */