mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-03-03 19:13:15 +01:00
Applyed Haiku patch by MrSunshine
This commit is contained in:
@@ -1881,7 +1881,18 @@ void floatToBuffer(OutBuffer *buf, Type *type, real_t value)
|
||||
if (r == value) // if exact duplication
|
||||
buf->writestring(buffer);
|
||||
else
|
||||
buf->printf("%La", value); // ensure exact duplication
|
||||
{
|
||||
#ifdef __HAIKU__ // broken printf workaround
|
||||
char buffer2[25];
|
||||
char *ptr = (char *)&value;
|
||||
for(int i = 0; i < sizeof(value); i++)
|
||||
snprintf(buffer2, sizeof(char), "%x", ptr[i]);
|
||||
|
||||
buf->writestring(buffer2);
|
||||
#else
|
||||
buf->printf("%La", value); // ensure exact duplication
|
||||
#endif
|
||||
}
|
||||
|
||||
if (type)
|
||||
{
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include <cmath>
|
||||
#endif
|
||||
|
||||
#include <sstream>
|
||||
|
||||
/* Lexical Analyzer */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -153,6 +153,7 @@ enum OS
|
||||
{
|
||||
OSinvalid,
|
||||
OSLinux,
|
||||
OSHaiku,
|
||||
OSWindows,
|
||||
OSMacOSX,
|
||||
OSFreeBSD,
|
||||
|
||||
@@ -315,7 +315,7 @@ char *Port::strupr(char *s)
|
||||
|
||||
#endif
|
||||
|
||||
#if linux || __APPLE__ || __FreeBSD__
|
||||
#if linux || __APPLE__ || __FreeBSD__ || __HAIKU__
|
||||
|
||||
#include <math.h>
|
||||
#if linux
|
||||
@@ -368,11 +368,15 @@ PortInitializer::PortInitializer()
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef __HAIKU__
|
||||
#undef isnan
|
||||
#endif
|
||||
int Port::isNan(double r)
|
||||
{
|
||||
#if __APPLE__
|
||||
return __inline_isnan(r);
|
||||
#elif defined __HAIKU__
|
||||
return isnan(r);
|
||||
#else
|
||||
return ::isnan(r);
|
||||
#endif
|
||||
@@ -382,6 +386,8 @@ int Port::isNan(long double r)
|
||||
{
|
||||
#if __APPLE__
|
||||
return __inline_isnan(r);
|
||||
#elif defined __HAIKU__
|
||||
return isnan(r);
|
||||
#else
|
||||
return ::isnan(r);
|
||||
#endif
|
||||
@@ -414,6 +420,8 @@ int Port::isInfinity(double r)
|
||||
{
|
||||
#if __APPLE__
|
||||
return fpclassify(r) == FP_INFINITE;
|
||||
#elif defined __HAIKU__
|
||||
return isinf(r);
|
||||
#else
|
||||
return ::isinf(r);
|
||||
#endif
|
||||
|
||||
@@ -40,7 +40,7 @@ struct Port
|
||||
static double dbl_min;
|
||||
static long double ldbl_max;
|
||||
|
||||
#if __GNUC__
|
||||
#if __GNUC__ && !defined __HAIKU__
|
||||
// These conflict with macros in math.h, should rename them
|
||||
#undef isnan
|
||||
#undef isfinite
|
||||
|
||||
@@ -34,6 +34,10 @@
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
#ifdef __HAIKU__
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
#if POSIX
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
Reference in New Issue
Block a user