|
@@ -13,7 +13,7 @@ pub fn hex_pair(x: u8) -> (char, char) {
|
|
|
(get_hex((x & 0xF0) >> 4), get_hex(x & 0x0F))
|
|
|
}
|
|
|
|
|
|
-pub fn to_line(data: &[u8]) -> String {
|
|
|
+/*pub fn to_line(data: &[u8]) -> String {
|
|
|
let mut out = String::new();
|
|
|
for byte in data {
|
|
|
let pair = hex_pair(*byte);
|
|
@@ -21,5 +21,17 @@ pub fn to_line(data: &[u8]) -> String {
|
|
|
out.push(pair.1);
|
|
|
}
|
|
|
out
|
|
|
+}*/
|
|
|
+
|
|
|
+
|
|
|
+pub fn create_line(data: &[u8], line: &mut [u8], length: usize, offset: usize) {
|
|
|
+ let mut i = 0;
|
|
|
+ for byte in 0..length {
|
|
|
+ let pair = hex_pair(*byte);
|
|
|
+ line[i] = pair.0 as u8;
|
|
|
+ line[i + 1] = pair.1 as u8;
|
|
|
+ i += 2;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|