mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +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 {
|
EmuStorage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn as_slice(&self) -> &[u8] {
|
pub fn as_slice<T>(&self) -> &[T] {
|
||||||
flashmem().memory.as_slice()
|
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] {
|
pub fn as_mut_slice(&mut self) -> &mut [u8] {
|
||||||
flashmem().memory.as_mut_slice()
|
flashmem().memory.as_mut_slice()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue