ref: 14e5a6c6bd5b3e8a936cd2184f9e2be59376357b
parent: ddca83a2f0f45046c7008bb3e19da5294a1bd160
parent: e819629b3ff1afb8ea0a879c526203edc94d45c0
author: Kevin Lenzo <66268906+lenzo-duo@users.noreply.github.com>
date: Mon Oct 5 09:04:19 EDT 2020
Merge pull request #48 from sthibaul/64bit Fix detecting 64bit systems
--- a/include/cst_val.h
+++ b/include/cst_val.h
@@ -46,6 +46,8 @@
#include "cst_alloc.h"
#include "cst_val_defs.h"
+#include <stdint.h>
+
/* Only CONS can be an even number */
#define CST_VAL_TYPE_CONS 0
#define CST_VAL_TYPE_INT 1
@@ -61,10 +63,15 @@
typedef struct cst_val_atom_struct {
#ifdef WORDS_BIGENDIAN
+#if UINTPTR_MAX > 0xfffffffful
+ int ref_count;
+ int type; /* order is here important */
+#else
short ref_count;
short type; /* order is here important */
+#endif
#else
-#if (defined(__x86_64__) || defined(_M_X64))
+#if UINTPTR_MAX > 0xfffffffful
int type; /* order is here important */
int ref_count;
#else
@@ -74,7 +81,7 @@
#endif
union
{
-#if (defined(__x86_64__) || defined(_M_X64))
+#if UINTPTR_MAX > 0xfffffffful
double fval;
long long ival;
void *vval;
--- a/include/cst_val_const.h
+++ b/include/cst_val_const.h
@@ -111,6 +111,8 @@
#include "cst_val_defs.h"
+#include <stdint.h>
+
/* There is built-in int to string conversions here for numbers */
/* up to 20, note if you make this bigger you have to hand change */
/* other things too */
@@ -191,10 +193,15 @@
/* unquestionably doing the wrong thing */
typedef struct cst_val_atom_struct_float {
#ifdef WORDS_BIGENDIAN
+#if UINTPTR_MAX > 0xfffffffful
+ int ref_count;
+ int type; /* order is here important */
+#else
short ref_count;
short type; /* order is here important */
+#endif
#else
-#if (defined(__x86_64__) || defined(_M_X64))
+#if UINTPTR_MAX > 0xfffffffful
int type; /* order is here important */
int ref_count;
#else
@@ -202,7 +209,7 @@
short ref_count;
#endif
#endif
-#if (defined(__x86_64__) || defined(_M_X64))
+#if UINTPTR_MAX > 0xfffffffful
double fval;
#else
float fval;
@@ -211,10 +218,15 @@
typedef struct cst_val_atom_struct_int {
#ifdef WORDS_BIGENDIAN
+#if UINTPTR_MAX > 0xfffffffful
+ int ref_count;
+ int type; /* order is here important (and unintuitive) */
+#else
short ref_count;
short type; /* order is here important (and unintuitive) */
+#endif
#else
-#if (defined(__x86_64__) || defined(_M_X64))
+#if UINTPTR_MAX > 0xfffffffful
int type; /* order is here important */
int ref_count;
#else
@@ -222,7 +234,7 @@
short ref_count;
#endif
#endif
-#if (defined(__x86_64__) || defined(_M_X64))
+#if UINTPTR_MAX > 0xfffffffful
long long ival;
#else
int ival;
@@ -231,10 +243,15 @@
typedef struct cst_val_atom_struct_void {
#ifdef WORDS_BIGENDIAN
+#if UINTPTR_MAX > 0xfffffffful
+ int ref_count;
+ int type; /* order is here important */
+#else
short ref_count;
short type; /* order is here important */
+#endif
#else
-#if (defined(__x86_64__) || defined(_M_X64))
+#if UINTPTR_MAX > 0xfffffffful
int type; /* order is here important */
int ref_count;
#else
--- a/src/wavesynth/cst_units.c
+++ b/src/wavesynth/cst_units.c
@@ -590,7 +590,7 @@
int unit_size, const unsigned char *unit_residual)
{
int i,m;
-#if (defined(__x86_64__) || defined(_M_X64))
+#if UINTPTR_MAX > 0xfffffffful
long long p;
/* Unit residual isn't a pointer its a number, the power for the
the sts, yes this is hackily casting the address to a number */