fixed encoding 0u8 (#992)

* fixed encoding 0u8

* simplified if else stmt
This commit is contained in:
Marek Kotewicz 2016-04-24 23:12:49 +02:00 committed by Gav Wood
parent 0b78a1ead9
commit 80a28b9b72
1 changed files with 6 additions and 2 deletions

View File

@ -307,10 +307,14 @@ struct EncodableU8 (u8);
impl ByteEncodable for EncodableU8 {
fn to_bytes<V: VecLike<u8>>(&self, out: &mut V) {
out.vec_push(self.0)
if self.0 != 0 {
out.vec_push(self.0)
}
}
fn bytes_len(&self) -> usize { 1 }
fn bytes_len(&self) -> usize {
match self.0 { 0 => 0, _ => 1 }
}
}
impl RlpEncodable for u8 {