mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
fix slicing to match that of the Xous environment
This commit is contained in:
parent
77e44075a6
commit
de991df43c
1 changed files with 7 additions and 2 deletions
|
|
@ -49,8 +49,13 @@ impl EmuStorage {
|
|||
EmuStorage {
|
||||
}
|
||||
}
|
||||
pub fn as_slice(&self) -> &[u8] {
|
||||
flashmem().memory.as_slice()
|
||||
pub fn as_slice<T>(&self) -> &[T] {
|
||||
unsafe {
|
||||
core::slice::from_raw_parts(
|
||||
flashmem().memory.as_ptr() as *const T,
|
||||
flashmem().memory.len() / core::mem::size_of::<T>(),
|
||||
)
|
||||
}
|
||||
}
|
||||
pub fn as_mut_slice(&mut self) -> &mut [u8] {
|
||||
flashmem().memory.as_mut_slice()
|
||||
|
|
|
|||
Loading…
Reference in a new issue