hgmath.h #if defined(HG_MATH_USE_HGASM) // nothing #elif defined(HG_MATH_USE_MSVC_INTRINSICS) extern "C" double sin(double x); #pragma intrinsic(sin) #elif defined(HG_MATH_USE_C) #include #include #elif defined(HG_MATH_USE_CXX) #include #include #endif namespace hg { #if defined(HG_MATH_USE_HGASM) float sin(float x); #elif defined(HG_MATH_USE_MSVC_INTRINSICS) inline float sin(float x) { return static_cast(::sin(static_cast(x)); } #elif defined(HG_MATH_USE_C) inline float sin(float x) { return ::sinf(x); } #elif defined(HG_MATH_USE_CXX) using std::sin; #endif } // namespace hg hgmath.cpp namespace hg { #if defined(HG_MATH_USE_HGASM) float _declspec(naked) hg_sin(float x) { __asm { fld [esp+4] fsin ret } }; #endif } // namespace hg