This commit fixes the macro DOFFSET in big-endian targets.
Tested in sparc64-linux-gnu in both -m64 and -m32.
Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/algol68/ChangeLog
PR algol68/123132
* a68-imports.cc (DOFFSET): Fix big-endian path.
if (pos + PTR_SIZE > size) \
goto decode_error; \
(V) = 0; \
- uint64_t ptr_bit_size = 8 * PTR_SIZE; \
if (BYTES_BIG_ENDIAN) \
{ \
for (int i = 0; i < PTR_SIZE; i++) \
- (V) = ((V) | ((uint8_t) data[pos + i] << (ptr_bit_size - (i * 8)))); \
+ (V) = ((V) | ((uint8_t) data[pos + i] << ((PTR_SIZE - i - 1) * 8))); \
} \
else \
{ \