refacto directory entries traversal

Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
This commit is contained in:
juju committed 2022-12-25 12:58:56 +01:00
1 parent d4add50d82
commit 0ad8ba9adb
3 files changed
+27 -26

No files matched your search

+14
View File
@@ -3,3 +3,17 @@ pub mod serialize;
pub use mutex::AsyncMutex;
pub use serialize::unserialize;
pub fn ref_offset<T>(r: &T, off: isize) -> &T {
let ref_ptr: *const T = r;
unsafe {
return &*ref_ptr.offset(off);
}
}
pub fn ref_raw_offset<T>(r: &T, off: isize) -> &T {
let ref_ptr: *const T = r;
unsafe {
return &*ref_ptr.cast::<u8>().offset(off).cast::<T>();
}
}
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.