mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-17 05:44:08 -07:00
all cpu-related stuff is now defined in cpu.h (with cpu_ prefix and fully encapsulated). fix quite brittle core/HT unit/package detection. implement mkdir on VC8, where it is deprecated add strdup on MacOSX move ia32 code into separate subdir. functions implemented in asm are called ia32_asm_*. add some unix versions of sysdep functions (cannot test them) timer: fix for amd64 linux This was SVN commit r4995.
70 lines
1.4 KiB
C++
70 lines
1.4 KiB
C++
/**
|
|
* =========================================================================
|
|
* File : sysdep.cpp
|
|
* Project : 0 A.D.
|
|
* Description : various system-specific function implementations
|
|
*
|
|
* @author Jan.Wassenberg@stud.uni-karlsruhe.de
|
|
* =========================================================================
|
|
*/
|
|
|
|
/*
|
|
* Copyright (c) 2003-2005 Jan Wassenberg
|
|
*
|
|
* Redistribution and/or modification are also permitted under the
|
|
* terms of the GNU General Public License as published by the
|
|
* Free Software Foundation (version 2 or later, at your option).
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
*/
|
|
|
|
#include "precompiled.h"
|
|
#include "sysdep.h"
|
|
|
|
|
|
// emulate C99 functionality
|
|
#if !HAVE_C99_MATH
|
|
|
|
// fallback versions in case ia32 optimized versions are unavailable.
|
|
#if !HAVE_MS_ASM
|
|
|
|
inline float rintf(float f)
|
|
{
|
|
return (float)(int)f;
|
|
}
|
|
|
|
inline double rint(double d)
|
|
{
|
|
return (double)(int)d;
|
|
}
|
|
|
|
float fminf(float a, float b)
|
|
{
|
|
return (a < b)? a : b;
|
|
}
|
|
|
|
float fmaxf(float a, float b)
|
|
{
|
|
return (a > b)? a : b;
|
|
}
|
|
|
|
uint fpclassify(double d)
|
|
{
|
|
// really sucky stub implementation; doesn't attempt to cover all cases.
|
|
|
|
if(d != d)
|
|
return FP_NAN;
|
|
else
|
|
return FP_NORMAL;
|
|
}
|
|
|
|
uint fpclassifyf(float f)
|
|
{
|
|
return fpclassify((double)f);
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif // #if !HAVE_C99_MATH
|