| 1 | use super::*; |
|---|---|
| 2 | |
| 3 | macro_rules! write_to_le_bytes { |
| 4 | ($($s:ident),*) => { |
| 5 | $(/// Implementation detail |
| 6 | pub fn $s(b: &$s) { |
| 7 | write(&b.to_le_bytes()) |
| 8 | })* |
| 9 | }; |
| 10 | } |
| 11 | |
| 12 | write_to_le_bytes!(u8, u16, u32, u64, u128, i8, i16, i32, i64, i128); |
| 13 | |
| 14 | /// Implementation detail |
| 15 | pub fn usize(b: &usize) { |
| 16 | write(&(*b as u32).to_le_bytes()) |
| 17 | } |
| 18 | |
| 19 | /// Implementation detail |
| 20 | pub fn isize(b: &isize) { |
| 21 | write(&(*b as i32).to_le_bytes()) |
| 22 | } |
| 23 |
