fixed encoding 0u8 (#992)
* fixed encoding 0u8 * simplified if else stmt
This commit is contained in:
parent
0b78a1ead9
commit
80a28b9b72
@ -307,10 +307,14 @@ struct EncodableU8 (u8);
|
|||||||
|
|
||||||
impl ByteEncodable for EncodableU8 {
|
impl ByteEncodable for EncodableU8 {
|
||||||
fn to_bytes<V: VecLike<u8>>(&self, out: &mut V) {
|
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 {
|
impl RlpEncodable for u8 {
|
||||||
|
Loading…
Reference in New Issue
Block a user