From: Ludovic Courtès Date: Mon, 20 Apr 2009 17:34:41 +0000 (+0200) Subject: bytevector: Add proper cast. X-Git-Tag: v0.2~4 X-Git-Url: https://repo.or.cz/w/guile-r6rs-libs.git/commitdiff_plain/42c5474ffec0d14801a7ba3299b38e2d8592f139 bytevector: Add proper cast. * src/bytevector.c (GENERIC_INTEGER_SET): Add correct cast of C_VALUE. This fixes a sign mismatch issue identified by GCC 4.3.1 on `sparc64-unknown-linux-gnu'. --- diff --git a/src/bytevector.c b/src/bytevector.c index d260f50..9d449aa 100644 --- a/src/bytevector.c +++ b/src/bytevector.c @@ -831,8 +831,11 @@ bytevector_unsigned_ref (const char *c_bv, size_t c_size, SCM endianness) \ swap = !scm_is_eq (endianness, native_endianness); \ \ - c_value16 = \ - swap ? bswap_16 (c_value) : c_value; \ + if (swap) \ + c_value16 = (INT_TYPE (16, _sign)) bswap_16 (c_value); \ + else \ + c_value16 = c_value; \ + \ memcpy (c_bv, &c_value16, 2); \ } \ else \