1 // hud_opts.hxx -- hud optimization tools
3 // Probably written by Norman Vine, started sometime in 1998 or 1999.
5 // Copyright (C) 1999 FlightGear Project
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.
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.
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.
28 # error This library requires C++
35 #include <simgear/compiler.h>
42 #if defined(USE_X86_ASM)
43 static __inline__ int FloatToInt(float f)
46 __asm__ ("fistpl %0" : "=m" (r) : "t" (f) : "st");
49 #elif defined(__MSC__) && defined(__WIN32__)
50 static __inline int FloatToInt(float f)
60 #define FloatToInt(F) ((int) ((F) < 0.0f ? (F)-0.5f : (F)+0.5f))