refacto unserialize

Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
This commit is contained in:
juju committed 2022-12-19 20:25:52 +01:00
1 parent f567198f75
commit dcaea4454b
4 files changed
+11 -16

No files matched your search

-16
View File
@@ -27,14 +27,6 @@ struct IsoPathTable {
}
impl IsoPathTable {
pub fn from(mapping: &u8) -> &Self {
let ptr: *const u8 = mapping;
let path_table_ptr: *const Self = ptr as *const Self;
unsafe {
&*path_table_ptr
}
}
#[allow(unaligned_references)]
pub fn get_idf(&self) -> &[u8] {
unsafe {
@@ -77,14 +69,6 @@ pub struct IsoDir {
}
impl IsoDir {
pub fn from(mapping: &u8) -> &Self {
let ptr: *const u8 = mapping;
let path_table_ptr: *const Self = ptr as *const Self;
unsafe {
&*path_table_ptr
}
}
#[allow(unaligned_references)]
pub fn get_idf(&self) -> &[u8] {
unsafe {
+1
View File
@@ -8,6 +8,7 @@ mod interrupts;
mod memory;
mod task;
mod fs;
mod utils;
//#[macro_use]
extern crate alloc;
+3
View File
@@ -0,0 +1,3 @@
pub mod serialize;
pub use serialize::unserialize;
+7
View File
@@ -0,0 +1,7 @@
pub fn unserialize<T>(mapping: &u8) -> &T {
let ptr: *const u8 = mapping;
let path_table_ptr: *const T = ptr as *const T;
unsafe {
&*path_table_ptr
}
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.