Skip to content
Snippets Groups Projects
Commit 9ab6d950 authored by Izzard, Robert Dr (Maths & Physics)'s avatar Izzard, Robert Dr (Maths & Physics)
Browse files

add a hack to handle the OSX case where ieee754.h is missing

parent 3e29a165
No related branches found
No related tags found
No related merge requests found
......@@ -559,6 +559,16 @@ if compiler.has_header('malloc.h',
cflags += '-D__HAVE_MALLOC_H__'
endif
############
# malloc.h #
#
if compiler.has_header('ieee754.h',
args: cflags,
include_directories: include_directories(incdirs))
cflags += '-D__HAVE_IEEE754_H__'
endif
############
# setitimer
#
......
......@@ -919,8 +919,10 @@ void Print_trace(void);
* use snprintf in place of strlcpy
*/
#ifndef __HAVE_LIBBSD__
#undef strlcpy
#define strlcpy(d,s,n) snprintf((d),(n),"%s",(s))
#define __STRLCPY_IS_MACRO__
#undef strlcat
#define strlcat(dest,source,size) __local_bsd_strlcat((dest),(source),(size))
#define __STRLCAT_IS_BSD_COPY__
#endif // __HAVE_LIBBSD__
......
......@@ -35,7 +35,9 @@
#include <stdlib.h>
#include "binary_c_drandr_types.h"
#include "binary_c_drandr_prototypes.h"
#ifdef __HAVE_IEEE754_H__
#include <ieee754.h>
#endif // ___HAVE_IEEE754_H__
#include <limits.h>
#include <stdint.h>
#include <sys/types.h>
......@@ -64,7 +66,11 @@ int binary_c_erand48_r (unsigned short int xsubi[3],
its fractional part so the resulting FP number is [0.0,1.0). */
temp.ieee.negative = 0;
#ifdef __HAVE_IEEE754_H__
temp.ieee.exponent = IEEE754_DOUBLE_BIAS;
#else
temp.ieee.exponent = 0x3ff; /* hard coded! */
#endif
temp.ieee.mantissa0 = (xsubi[2] << 4) | (xsubi[1] >> 12);
temp.ieee.mantissa1 = ((xsubi[1] & 0xfff) << 20) | (xsubi[0] << 4);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment