1use core::slice;
3
4pub unsafe fn make_static(r: &[u8]) -> &'static [u8] {
5 return slice::from_raw_parts(&r[0] as *const u8, r.len());
6}
7
8pub struct Void;
10impl Void {
11 pub const fn new() -> Self { Self {} }
12}
13
14pub fn flush<T>(thing: &T) -> T {
18 unsafe { core::ptr::read_volatile(thing as *const T) }
19}
20
21#[macro_export]
39macro_rules! EXTERN_SYM_PTR {
40 ($vis:vis $name:ident , $ext:ident) => {
41 extern "C" {
42 fn $ext();
43 }
44 $vis const $name:*const () = $ext as *const ();
45 };
46
47 ($vis:vis $name:ident : $ty:ty = $ext:ident) => {
48 extern "C" {
49 fn $ext();
50 }
51 $vis const $name:*const () = $ext as *const () as $ty;
52 };
53
54}