libg722_1
0.0.1
|
00001 /* 00002 * SpanDSP - a series of DSP components for telephony 00003 * 00004 * tgmath.h - a fudge for MSVC, which lacks this header 00005 * 00006 * Written by Steve Underwood <steveu@coppice.org> 00007 * 00008 * Copyright (C) 2006 Michael Jerris 00009 * 00010 * 00011 * This file is released in the public domain. 00012 * 00013 */ 00014 00015 #if !defined(_TGMATH_H_) 00016 #define _TGMATH_H_ 00017 00018 #include <math.h> 00019 00020 #if !defined(M_PI) 00021 /* C99 systems may not define M_PI */ 00022 #define M_PI 3.14159265358979323846264338327 00023 #endif 00024 00025 00026 #ifdef __cplusplus 00027 extern "C" { 00028 #endif 00029 00030 /* A kindofa rint() for VC++ (only kindofa, because rint should be type generic, 00031 and this one is purely float to int */ 00032 static inline long int lrintf(float a) 00033 { 00034 long int i; 00035 00036 __asm 00037 { 00038 fld a 00039 fistp i 00040 } 00041 return i; 00042 } 00043 00044 static inline long int lrint(double a) 00045 { 00046 long int i; 00047 00048 __asm 00049 { 00050 fld a 00051 fistp i 00052 } 00053 return i; 00054 } 00055 00056 static inline int rintf(float a) 00057 { 00058 int i; 00059 00060 __asm 00061 { 00062 fld a 00063 fistp i 00064 } 00065 return i; 00066 } 00067 00068 static inline int rint(double a) 00069 { 00070 int i; 00071 00072 __asm 00073 { 00074 fld a 00075 fistp i 00076 } 00077 return i; 00078 } 00079 00080 #ifdef __cplusplus 00081 } 00082 #endif 00083 00084 #endif