[UCRTBASE] Implement simplistic versions of some stubs

This is to allow ucrtbase_winetest to run without debug breaks.
Proper implementations will follow.
This commit is contained in:
Timo Kreuzer 2025-01-25 21:01:39 +02:00
parent f81c82f5fa
commit 01cd8472c7

View file

@ -1,6 +1,9 @@
#include <stdint.h> #include <stdint.h>
#include <intrin.h> #include <intrin.h>
#include <malloc.h>
#define _USE_MATH_DEFINES
#include <math.h>
// atexit is needed by libsupc++ // atexit is needed by libsupc++
extern int __cdecl _crt_atexit(void (__cdecl*)(void)); extern int __cdecl _crt_atexit(void (__cdecl*)(void));
@ -9,13 +12,11 @@ int __cdecl atexit(void (__cdecl* function)(void))
return _crt_atexit(function); return _crt_atexit(function);
} }
void* __cdecl malloc(size_t);
void* __cdecl operator_new(size_t size) void* __cdecl operator_new(size_t size)
{ {
return malloc(size); return malloc(size);
} }
void free(void*);
void _cdecl operator_delete(void *mem) void _cdecl operator_delete(void *mem)
{ {
free(mem); free(mem);
@ -48,26 +49,25 @@ int __cdecl __acrt_initialize_sse2(void)
double fma(double x, double y, double z) double fma(double x, double y, double z)
{ {
__debugbreak(); // Simplistic implementation
return 0.; return (x * y) + z;
} }
float fmaf(float x, float y, float z) float fmaf(float x, float y, float z)
{ {
__debugbreak(); // Simplistic implementation
return 0.; return (x * y) + z;
} }
double log2(double x) double log2(double x)
{ {
__debugbreak(); // Simplistic implementation: log2(x) = log(x) / log(2)
return 0.; return log(x) * M_LOG2E;
} }
float log2f(float x) float log2f(float x)
{ {
__debugbreak(); return (float)log2((double)x);
return 0.;
} }
long int lrint(double x) long int lrint(double x)