From 54ec04f1c12c7fb4dbe5f01fdeb73d1079fef53d Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Mon, 14 Apr 2014 20:04:14 +1000 Subject: Use the unsigned integer types for bitwise intrinsics. Exposing ctpop, ctlz, cttz and bswap as taking signed i8/i16/... is just exposing the internal LLVM names pointlessly (LLVM doesn't have "signed integers" or "unsigned integers", it just has sized integer types with (un)signed *operations*). These operations are semantically working with raw bytes, which the unsigned types model better. --- src/libserialize/ebml.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libserialize') diff --git a/src/libserialize/ebml.rs b/src/libserialize/ebml.rs index 9b2df307b99..0efa93011fc 100644 --- a/src/libserialize/ebml.rs +++ b/src/libserialize/ebml.rs @@ -179,8 +179,8 @@ pub mod reader { ]; unsafe { - let ptr = data.as_ptr().offset(start as int) as *i32; - let val = from_be32(*ptr) as u32; + let ptr = data.as_ptr().offset(start as int) as *u32; + let val = from_be32(*ptr); let i = (val >> 28u) as uint; let (shift, mask) = SHIFT_MASK_TABLE[i]; -- cgit 1.4.1-3-g733a5