Rather than evaluating TARGET_BIG_ENDIAN at preprocessing time via #ifdef'ry, do it in C at compile time
Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org> --- include/gdbstub/helpers.h | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/include/gdbstub/helpers.h b/include/gdbstub/helpers.h index 6f7cc48adcb..c33d5dfca3e 100644 --- a/include/gdbstub/helpers.h +++ b/include/gdbstub/helpers.h @@ -56,17 +56,10 @@ static inline int gdb_get_reg128(GByteArray *buf, uint64_t val_hi, uint64_t val_lo) { uint64_t to_quad; -#if TARGET_BIG_ENDIAN - to_quad = tswap64(val_hi); + to_quad = tswap64(TARGET_BIG_ENDIAN ? val_hi : val_lo); g_byte_array_append(buf, (uint8_t *) &to_quad, 8); - to_quad = tswap64(val_lo); + to_quad = tswap64(TARGET_BIG_ENDIAN ? val_lo : val_hi); g_byte_array_append(buf, (uint8_t *) &to_quad, 8); -#else - to_quad = tswap64(val_lo); - g_byte_array_append(buf, (uint8_t *) &to_quad, 8); - to_quad = tswap64(val_hi); - g_byte_array_append(buf, (uint8_t *) &to_quad, 8); -#endif return 16; } -- 2.47.1