mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-01-12 01:30:03 +00:00
Some compilers don't permit the use of C99 extensions from C++. This is the
case for MIPSPro (IRIX) for fegetround(), isinf() et al., though they are available in the math library.
This commit is contained in:
parent
28ed73f212
commit
f75d445700
58
SheepShaver/src/kpx_cpu/src/mathlib/ieeefp-mips.hpp
Normal file
58
SheepShaver/src/kpx_cpu/src/mathlib/ieeefp-mips.hpp
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* ieee-mips.hpp - IEE754 Floating-Point Math library, mips specific code
|
||||
*
|
||||
* Kheperix (C) 2003-2005 Gwenole Beauchesne
|
||||
* Code derived from the GNU C Library
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef IEEEFP_MIPS_H
|
||||
#define IEEEFP_MIPS_H
|
||||
|
||||
// 7.6 Floating-point environment <fenv.h>
|
||||
#ifndef USE_FENV_H
|
||||
|
||||
// Exceptions
|
||||
enum {
|
||||
FE_INEXACT = 0x04,
|
||||
#define FE_INEXACT FE_INEXACT
|
||||
FE_UNDERFLOW = 0x08,
|
||||
#define FE_UNDERFLOW FE_UNDERFLOW
|
||||
FE_OVERFLOW = 0x10,
|
||||
#define FE_OVERFLOW FE_OVERFLOW
|
||||
FE_DIVBYZERO = 0x20,
|
||||
#define FE_DIVBYZERO FE_DIVBYZERO
|
||||
FE_INVALID = 0x40,
|
||||
#define FE_INVALID FE_INVALID
|
||||
};
|
||||
|
||||
#define FE_ALL_EXCEPT (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
|
||||
|
||||
// Rounding modes
|
||||
enum {
|
||||
FE_TONEAREST = 0x0,
|
||||
#define FE_TONEAREST FE_TONEAREST
|
||||
FE_TOWARDZERO = 0x1,
|
||||
#define FE_TOWARDZERO FE_TOWARDZERO
|
||||
FE_UPWARD = 0x2,
|
||||
#define FE_UPWARD FE_UPWARD
|
||||
FE_DOWNWARD = 0x3
|
||||
#define FE_DOWNWARD FE_DOWNWARD
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* IEEEFP_MIPS_H */
|
@ -21,12 +21,22 @@
|
||||
#ifndef IEEEFP_H
|
||||
#define IEEEFP_H
|
||||
|
||||
// Can we use C99 extensions in C++ mode?
|
||||
#ifdef HAVE_FENV_H
|
||||
#if defined __GNUC__
|
||||
#define USE_FENV_H 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Arch-dependent definitions
|
||||
#if defined(__i386__)
|
||||
#include "mathlib/ieeefp-i386.hpp"
|
||||
#endif
|
||||
#if defined(__mips__) || (defined(sgi) && defined(mips))
|
||||
#include "mathlib/ieeefp-mips.hpp"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FENV_H
|
||||
#ifdef USE_FENV_H
|
||||
#include <fenv.h>
|
||||
#else
|
||||
|
||||
|
@ -175,4 +175,15 @@ extern int mathlib_signbitl(long double x);
|
||||
#define isless(x, y) ((x) < (y))
|
||||
#endif
|
||||
|
||||
// 7.12.3.3 The isinf macro
|
||||
#ifndef isinf
|
||||
#if defined __sgi && defined __mips
|
||||
// specialized implementation for IRIX mips compilers
|
||||
extern "C" int _isinf(double);
|
||||
extern "C" int _isinff(float);
|
||||
static inline int isinf(double x) { return _isinf(x); }
|
||||
static inline int isinf(float x) { return _isinff(x); }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* MATHLIB_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user