correctly handle 1 byte ranges
This commit is contained in:
@@ -44,15 +44,10 @@ impl<'s, T: Scannable + ?Sized, R: RangeBounds<usize>> Display for HexDump<'s, T
|
||||
(start, end)
|
||||
};
|
||||
|
||||
// if there is nothing to print then just return...
|
||||
// this also prevents the ilog below from crashing :)
|
||||
if end == 0 || start > end {
|
||||
write!(f,"<empty>");
|
||||
return Ok(())
|
||||
}
|
||||
|
||||
// the number of digits the address column should have
|
||||
let digits = (end.ilog(16) as usize + 1).max(4);
|
||||
let digits = if end == 0 { 4 } else {
|
||||
(end.ilog(16) as usize + 1).max(4)
|
||||
};
|
||||
|
||||
for (mut addr, chunk) in ChunkIter::new(self.0, start) {
|
||||
for chunk in chunk.chunks(16) {
|
||||
|
||||
Reference in New Issue
Block a user