ReactOS 0.4.15-dev-7834-g00c4b3d
fixed.h
Go to the documentation of this file.
1/* $Id: fixed.h,v 1.2 1996/10/01 03:31:04 brianp Exp $ */
2
3/*
4 * Mesa 3-D graphics library
5 * Version: 2.0
6 * Copyright (C) 1995-1996 Brian Paul
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the Free
20 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23
24/*
25 *
26 * Revision 1.1 1996/09/13 01:38:16 brianp
27 * Initial revision
28 *
29 */
30
31
32#ifndef FIXED_H
33#define FIXED_H
34
35
36typedef int GLfixed;
37
38#define FIXED_ONE 0x00000800
39#define FIXED_HALF 0x00000400
40#define FIXED_FRAC_MASK 0x000007FF
41#define FIXED_INT_MASK (~FIXED_FRAC_MASK)
42#define FIXED_EPSILON 1
43#define FIXED_SCALE 2048.0f
44#define FIXED_SHIFT 11
45#define FloatToFixed(X) ((GLfixed) ((X) * FIXED_SCALE))
46#define IntToFixed(I) ((I) << FIXED_SHIFT)
47#define FixedToInt(X) ((X) >> FIXED_SHIFT)
48#define FixedToUns(X) (((unsigned int)(X)) >> 11)
49#define FixedCeil(X) (((X) + FIXED_ONE - FIXED_EPSILON) & FIXED_INT_MASK)
50#define FixedFloor(X) ((X) & FIXED_INT_MASK)
51/* 0.00048828125 = 1/FIXED_SCALE */
52#define FixedToFloat(X) ((X) * 0.00048828125f)
53#define PosFloatToFixed(X) FloatToFixed(X)
54#define SignedFloatToFixed(X) FloatToFixed(X)
55
56
57#endif
int GLfixed
Definition: fixed.h:36