summaryrefslogtreecommitdiffstats
path: root/itypes.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-06-06 06:46:28 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-06-06 06:46:28 -0700
commit7f35218581067e5b3449258326a54235d6e10bbc (patch)
treef94237cef9897672654d603ef43fbe45844b7a6f /itypes.c
parent840330f271f25b093c7a86b41e7cddaec0cb6d7f (diff)
downloadtxr-7f35218581067e5b3449258326a54235d6e10bbc.tar.gz
txr-7f35218581067e5b3449258326a54235d6e10bbc.tar.bz2
txr-7f35218581067e5b3449258326a54235d6e10bbc.zip
c++ maintenance: eliminate old-style casts.
Old style casts have crept into the code base. * buf.c (make_buf, buf_grow, buf_get_i8, buf_get_u8): Replace old style cast with macro. * ffi.c (align_sw_get, align_sw_put, ffi_be_i32_get, ffi_be_u32_get, ffi_le_i32_put, ffi_le_i32_get, ffi_le_u32_get, ffi_be_i64_put, ffi_be_i64_get, ffi_be_u64_get, ffi_le_i64_put, ffi_le_i64_get, ffi_le_u64_get, ffi_sbit_put, ffi_sbit_get, ffi_init_extra_types): Likewise. * hash.c (hash_buf): Likewise. * itypes.c (c_i32, c_i64, c_u64): Likewise. * stream.c (stdio_put_buf, stdio_fill_buf): Likewise.
Diffstat (limited to 'itypes.c')
-rw-r--r--itypes.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/itypes.c b/itypes.c
index a9126f6f..992b19ca 100644
--- a/itypes.c
+++ b/itypes.c
@@ -81,7 +81,7 @@ u16_t c_u16(val n, val self)
i32_t c_i32(val n, val self)
{
cnum v = c_num(n);
- if (v < (- (cnum) 0x7FFFFFFF - 1) || v > (cnum) 0x7FFFFFFF)
+ if (v < (-convert(cnum, 0x7FFFFFFF) - 1) || v > 0x7FFFFFFF)
uw_throwf(error_s, lit("~a: value ~s is out of signed 32 bit range"),
self, n, nao);
return v;
@@ -121,14 +121,14 @@ i64_t c_i64(val n, val self)
{
val low32 = logtrunc(n, num_fast(32));
val high32 = ash(n, num_fast(-32));
- return ((i64_t) c_i32(high32, self)) << 32 | c_u32(low32, self);
+ return convert(i64_t, c_i32(high32, self)) << 32 | c_u32(low32, self);
}
u64_t c_u64(val n, val self)
{
val low32 = logtrunc(n, num_fast(32));
val high32 = ash(n, num_fast(-32));
- return ((u64_t) c_u32(high32, self)) << 32 | c_u32(low32, self);
+ return convert(u64_t, c_u32(high32, self)) << 32 | c_u32(low32, self);
}
#endif
#endif