diff --git a/libguile/bytevectors.c b/libguile/bytevectors.c index fff5355..8574a36 100644 --- a/libguile/bytevectors.c +++ b/libguile/bytevectors.c @@ -103,7 +103,7 @@ \ memcpy (&c_result, &c_bv[c_index], (_len) / 8); \ if (!scm_is_eq (endianness, scm_i_native_endianness)) \ - c_result = INT_SWAP (_len) (c_result); \ + c_result = (INT_TYPE (_len, _sign)) INT_SWAP (_len) ((INT_TYPE (_len, unsigned)) c_result); \ \ result = SCM_I_MAKINUM (c_result); \ } \ @@ -143,7 +143,7 @@ \ c_value_short = (INT_TYPE (_len, _sign)) c_value; \ if (!scm_is_eq (endianness, scm_i_native_endianness)) \ - c_value_short = INT_SWAP (_len) (c_value_short); \ + c_value_short = (INT_TYPE (_len, _sign)) INT_SWAP (_len) ((INT_TYPE (_len, unsigned)) c_value_short); \ \ memcpy (&c_bv[c_index], &c_value_short, (_len) / 8); \ } \ @@ -918,7 +918,7 @@ bytevector_large_set (char *c_bv, size_t c_size, int signed_p, INT_TYPE (16, _sign) c_value16; \ memcpy (&c_value16, c_bv, 2); \ if (swap) \ - value = (INT_TYPE (16, _sign)) bswap_16 (c_value16); \ + value = (INT_TYPE (16, _sign)) bswap_16 ((scm_t_uint16) c_value16); \ else \ value = c_value16; \ } \ @@ -981,7 +981,7 @@ bytevector_unsigned_ref (const char *c_bv, size_t c_size, SCM endianness) swap = !scm_is_eq (endianness, scm_i_native_endianness); \ \ if (swap) \ - c_value16 = (INT_TYPE (16, _sign)) bswap_16 (c_value); \ + c_value16 = (INT_TYPE (16, _sign)) bswap_16 ((scm_t_uint16) c_value); \ else \ c_value16 = c_value; \ \