Changeset 652


Ignore:
Timestamp:
Mar 21, 2006, 10:48:02 AM (15 years ago)
Author:
Sam Hocevar
Message:
  • Use the asm versions of sin and cos when available.
Location:
libcaca/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/configure.ac

    r629 r652  
    5959 [AC_MSG_RESULT(yes)
    6060  AC_DEFINE(HAVE_SLEEP, 1, [Define to 1 if you have the `Sleep' function.])],
     61 [AC_MSG_RESULT(no)])
     62AC_MSG_CHECKING(for fsin/fcos)
     63AC_TRY_COMPILE([],[asm("fsin\n\tfcos");],
     64 [AC_MSG_RESULT(yes)
     65  AC_DEFINE(HAVE_FSIN_FCOS, 1, [Define to 1 if you have the `fsin' and `fcos' operands.])],
    6166 [AC_MSG_RESULT(no)])
    6267AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
  • libcaca/trunk/kernel/kernel.c

    r617 r652  
    228228{
    229229    double ret = 0.0;
     230#ifdef HAVE_FSIN_FCOS
     231    asm volatile("fcos" : "=t" (ret) : "0" (x));
     232#else
    230233    double x2;
    231234    double num = 1.0;
     
    243246        fact *= (2 * i + 1) * (2 * i + 2);
    244247    }
    245 
     248#endif
    246249    return ret;
    247250}
     
    250253{
    251254    double ret = 0.0;
     255#ifdef HAVE_FSIN_FCOS
     256    asm volatile("fsin" : "=t" (ret) : "0" (x));
     257#else
    252258    double x2;
    253259    double num;
     
    266272        fact *= (2 * i + 2) * (2 * i + 3);
    267273    }
    268 
     274#endif
    269275    return ret;
    270276}
Note: See TracChangeset for help on using the changeset viewer.