Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

gr_sincos.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2002 Free Software Foundation, Inc.
00004  * 
00005  * This file is part of GNU Radio
00006  * 
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2, or (at your option)
00010  * any later version.
00011  * 
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00020  * Boston, MA 02111-1307, USA.
00021  */
00022 
00023 #ifdef __cplusplus
00024 # define __GR_MATH_INLINE __inline
00025 #else
00026 # define __GR_MATH_INLINE extern __inline
00027 #endif
00028 
00029 #  define __sincos_code \
00030   register long double __cosr;                                                \
00031   register long double __sinr;                                                \
00032   __asm __volatile__                                                          \
00033     ("fsincos\n\t"                                                            \
00034      "fnstsw    %%ax\n\t"                                                     \
00035      "testl     $0x400, %%eax\n\t"                                            \
00036      "jz        1f\n\t"                                                       \
00037      "fldpi\n\t"                                                              \
00038      "fadd      %%st(0)\n\t"                                                  \
00039      "fxch      %%st(1)\n\t"                                                  \
00040      "2: fprem1\n\t"                                                          \
00041      "fnstsw    %%ax\n\t"                                                     \
00042      "testl     $0x400, %%eax\n\t"                                            \
00043      "jnz       2b\n\t"                                                       \
00044      "fstp      %%st(1)\n\t"                                                  \
00045      "fsincos\n\t"                                                            \
00046      "1:"                                                                     \
00047      : "=t" (__cosr), "=u" (__sinr) : "0" (__x));                             \
00048   *__sinx = __sinr;                                                           \
00049   *__cosx = __cosr
00050 
00051 __GR_MATH_INLINE void
00052 __sincos (double __x, double *__sinx, double *__cosx) __THROW
00053 {
00054   __sincos_code;
00055 }
00056 
00057 __GR_MATH_INLINE void
00058 __sincosf (float __x, float *__sinx, float *__cosx) __THROW
00059 {
00060   __sincos_code;
00061 }
00062 
00063 __GR_MATH_INLINE void
00064 __sincosl (long double __x, long double *__sinx, long double *__cosx) __THROW
00065 {
00066   __sincos_code;
00067 }
00068 
00069 #undef __sincos_code
00070 #undef __GR_MATH_INLINE

Generated on Wed Mar 23 12:30:22 2005 for GNU Radio by  doxygen 1.4.0