Files
Cyd 2b8ca921cb Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS
Complete disaster-recovery snapshot: engine/game source, game data assets,
VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive.
Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false,
no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
2026-06-24 21:28:16 -05:00

79 lines
1.5 KiB
C

/**********************************************************************
*<
FILE: gfloat
DESCRIPTION: Single Precision Floating Point Routines
CREATED BY: Don Brittain & Dan Silva
HISTORY:
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef _GFLOAT_H
#define _GFLOAT_H
//-------------------------------------------------------------------------------
// Single precision floating point stuff...
//
inline void SinCos (float angle, float *sine, float *cosine)
{
#ifdef _M_IX86 // if on Intel, use assembly language
__asm {
push ecx
fld dword ptr angle
fsincos
mov ecx, dword ptr[cosine]
fstp dword ptr [ecx]
mov ecx, dword ptr[sine]
fstp dword ptr [ecx]
pop ecx
}
#else
*sine = (float)sin (angle);
*cosine = (float)cos (angle);
#endif
}
inline float Sin(float angle)
{
#ifdef _M_IX86
float s, c;
SinCos(angle, &s, &c);
return s;
#else
return (float)sin((double)angle);
#endif
}
inline float Cos(float angle)
{
#ifdef _M_IX86
float s, c;
SinCos(angle, &s, &c);
return c;
#else
return (float)cos((double)angle);
#endif
}
inline float Sqrt(float arg)
{
#ifdef _M_IX86
float ans;
__asm {
fld dword ptr arg
fsqrt
fstp dword ptr [ans]
}
return ans;
#else
return (float)sqrt((double)arg);
#endif
}
#endif