#include #include "ti_config.h" #define func1( fl, f ) \ jdouble m ## fl ## f ## DmT4Math4lang4java ( jdouble value ) \ { \ return f( value ); \ } #define func2( fl, f ) \ jdouble m ## fl ## f ## DDmT4Math4lang4java ( jdouble x, jdouble y ) \ { \ return f( x, y ); \ } /* code-genned calls to these native methods are automatically inlined in code-call.cc */ func1( 4, acos ) func1( 4, asin ) func1( 4, atan ) func1( 4, ceil ) func1( 3, cos ) func1( 3, exp ) func1( 5, floor ) func1( 3, log ) func1( 4, rint ) func1( 3, sin ) func1( 4, sqrt ) func1( 3, tan ) func2( 13, IEEEremainder ) func2( 5, atan2 ) func2( 3, pow ) /* -------------------------------------------------------------------- */ /* intpow(): a fast version of pow() optimized for integer arguments * Copyright 2001, Dan Bonachea * beats the pow() in gcc-3.01's libmath by about 2x on Linux and 4x Solaris for integer arguments */ /* some helper macros that do exponentiation by shifting */ /* constraints: * x_const == 2 ^ (2 ^ y_shift) * x_const ^ y_bound fits in 63 bits * y_bound << y_shift fits in 31 bits */ #define X_CASEP(x_const, y_bound, y_shift) \ case x_const: if (y <= y_bound) return (double) (((int64_t)1) << (y<0 ? (x) : (y=-y, 1.0/x)); register double retval = 1.0; while (y > 1) { if (y&0x1) retval *= temp; y = y >> 1; temp *= temp; } return retval * temp; } } /* -------------------------------------------------------------------- */