Skip to content

Commit 63e9892

Browse files
committed
Merge branch 'gh183-add-dtoa-endian-check' into 'v100-bugfix'
define IEEE_MC68k instead of IEEE_8087 on big endian machines See merge request integer/scip!4095
2 parents 39079e4 + 340ebd4 commit 63e9892

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Fixed bugs
88

99
- fixed call of SCIPcreateConsBasicSOCNonlinear() with coefs being NULL, and fixed check for offsets being finite
1010
- avoid crash when initial IIS solve fails while reporting errors explicitly
11+
- fixed failure in nl writing on big endian machines
1112

1213

1314
@section RN1000 SCIP 10.0.0

src/amplmp/src/dtoa.cpp

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,30 @@ extern void *REALLOC(void*,size_t);
278278
static double private_mem[PRIVATE_mem], *pmem_next = private_mem;
279279
#endif
280280

281+
// SV added define of IEEE_MC68k or IEEE_8087, depending on guess of endianness
282+
#if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN || \
283+
defined(__BIG_ENDIAN__) || \
284+
defined(__ARMEB__) || \
285+
defined(__THUMBEB__) || \
286+
defined(__AARCH64EB__) || \
287+
defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__)
288+
// It's a big-endian target architecture
289+
#define IEEE_MC68k
290+
#elif defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || \
291+
defined(__LITTLE_ENDIAN__) || \
292+
defined(__ARMEL__) || \
293+
defined(__THUMBEL__) || \
294+
defined(__AARCH64EL__) || \
295+
defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__)
296+
// It's a little-endian target architecture
297+
#define IEEE_8087
298+
#else
299+
#ifndef _MSC_VER // MSVS does not have #warning
300+
#warning "Not recognizing endianness of architecture, assuming little endian."
301+
#endif
302+
#define IEEE_8087
303+
#endif
304+
281305
#undef IEEE_Arith
282306
#undef Avoid_Underflow
283307
#ifdef IEEE_MC68k
@@ -349,8 +373,7 @@ static double private_mem[PRIVATE_mem], *pmem_next = private_mem;
349373
extern "C" {
350374
#endif
351375

352-
#define IEEE_8087
353-
#define IEEE_Arith
376+
// SV removed define of IEEE_8087 and IEEE_Arith - they are defined at the top now
354377
#if defined(IEEE_8087) + defined(IEEE_MC68k) + defined(VAX) + defined(IBM) != 1
355378
Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined.
356379
#endif

0 commit comments

Comments
 (0)