]> git.mxchange.org Git - flightgear.git/blob - src/Cockpit/hud_opts.hxx
Moved src/Model/loader.[ch]xx and src/Model/model.[ch]xx to
[flightgear.git] / src / Cockpit / hud_opts.hxx
1 // hud_opts.hxx -- hud optimization tools
2 //
3 // Probably written by Norman Vine, started sometime in 1998 or 1999.
4 //
5 // Copyright (C) 1999  FlightGear Project
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 //
21 // $Id$
22
23
24 #ifndef _HUD_OPTS_HXX
25 #define _HUD_OPTS_HXX
26
27 #ifndef __cplusplus
28 # error This library requires C++
29 #endif
30
31 #ifdef HAVE_CONFIG_H
32 #  include <config.h>
33 #endif
34
35 #include <simgear/compiler.h>
36
37
38 #if defined(i386)
39 #define USE_X86_ASM
40 #endif
41
42 #if defined(USE_X86_ASM)
43 static __inline__ int FloatToInt(float f)
44 {
45    int r;
46    __asm__ ("fistpl %0" : "=m" (r) : "t" (f) : "st");
47    return r;
48 }
49 #elif  defined(__MSC__) && defined(__WIN32__)
50 static __inline int FloatToInt(float f)
51 {
52    int r;
53    _asm {
54      fld f
55      fistp r
56     }
57    return r;
58 }
59 #else
60 #define FloatToInt(F) ((int) ((F) < 0.0f ? (F)-0.5f : (F)+0.5f))
61 #endif
62
63
64 #endif // _HUD_OPTS_H