mirror of
https://github.com/reactos/reactos.git
synced 2025-05-06 18:31:26 +00:00

This is to allow ucrtbase_winetest to run without debug breaks. Proper implementations will follow.
83 lines
1.4 KiB
C
83 lines
1.4 KiB
C
|
|
#include <stdint.h>
|
|
#include <intrin.h>
|
|
#include <malloc.h>
|
|
#define _USE_MATH_DEFINES
|
|
#include <math.h>
|
|
|
|
// atexit is needed by libsupc++
|
|
extern int __cdecl _crt_atexit(void (__cdecl*)(void));
|
|
int __cdecl atexit(void (__cdecl* function)(void))
|
|
{
|
|
return _crt_atexit(function);
|
|
}
|
|
|
|
void* __cdecl operator_new(size_t size)
|
|
{
|
|
return malloc(size);
|
|
}
|
|
|
|
void _cdecl operator_delete(void *mem)
|
|
{
|
|
free(mem);
|
|
}
|
|
|
|
#ifdef _M_IX86
|
|
void _chkesp_failed(void)
|
|
{
|
|
__debugbreak();
|
|
}
|
|
#endif
|
|
|
|
int __cdecl __acrt_initialize_sse2(void)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
// The following stubs cannot be implemented as stubs by spec2def, because they are intrinsics
|
|
|
|
#ifdef _MSC_VER
|
|
#pragma warning(disable:4163) // not available as an intrinsic function
|
|
#pragma warning(disable:4164) // intrinsic function not declared
|
|
#pragma function(fma)
|
|
#pragma function(fmaf)
|
|
#pragma function(log2)
|
|
#pragma function(log2f)
|
|
#pragma function(lrint)
|
|
#pragma function(lrintf)
|
|
#endif
|
|
|
|
double fma(double x, double y, double z)
|
|
{
|
|
// Simplistic implementation
|
|
return (x * y) + z;
|
|
}
|
|
|
|
float fmaf(float x, float y, float z)
|
|
{
|
|
// Simplistic implementation
|
|
return (x * y) + z;
|
|
}
|
|
|
|
double log2(double x)
|
|
{
|
|
// Simplistic implementation: log2(x) = log(x) / log(2)
|
|
return log(x) * M_LOG2E;
|
|
}
|
|
|
|
float log2f(float x)
|
|
{
|
|
return (float)log2((double)x);
|
|
}
|
|
|
|
long int lrint(double x)
|
|
{
|
|
__debugbreak();
|
|
return 0;
|
|
}
|
|
|
|
long int lrintf(float x)
|
|
{
|
|
__debugbreak();
|
|
return 0;
|
|
}
|