提交 508fef5d 编写于 作者: S Simonas Kazlauskas 提交者: est31

impl Step for iu128

Also fix the leb128 tests
上级 db2527ad
......@@ -242,6 +242,8 @@ fn steps_between_by_one(start: &Self, end: &Self) -> Option<usize> {
// assume here that it is less than 64-bits.
#[cfg(not(target_pointer_width = "64"))]
step_impl_no_between!(u64 i64);
#[cfg(not(stage0))]
step_impl_no_between!(u128 i128);
/// An adapter for stepping range iterators by a custom amount.
///
......
......@@ -154,22 +154,13 @@ fn test_unsigned_leb128() {
#[test]
fn test_signed_leb128() {
let mut values = Vec::new();
let mut i = -500;
while i < 500 {
values.push(i * 123457i64);
i += 1;
}
let values: Vec<_> = (-500..500).map(|i| i * 0x12345789ABCDEF).collect();
let mut stream = Vec::new();
for &x in &values {
let pos = stream.len();
let bytes_written = write_signed_leb128(&mut stream, pos, x);
assert_eq!(stream.len(), pos + bytes_written);
}
let mut pos = 0;
for &x in &values {
let (value, bytes_read) = read_signed_leb128(&mut stream, pos);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册