1#![no_std]
2#![warn(missing_docs)]
3
4const fn const_bound_check(index: usize, bound: usize) -> usize {
15 const ARRAY: [&str; 1] = ["index out of bounds"];
16 ARRAY[(index >= bound) as usize];
17 index
18}
19
20macro_rules! const_assert {
21 ($expr:expr) => {
22 const _: () = {
23 #[allow(dead_code)]
24 const FAILED_ASSERTION: [&str; 1] =
25 [concat!("failed assertion: '", stringify!($expr), "' is false",)];
26 #[allow(dead_code)]
27 const CONDITION: bool = $expr;
28 #[allow(dead_code)]
29 const ASSERTION: &str = FAILED_ASSERTION[(!CONDITION) as usize];
30 };
31 };
32
33 ($expr:expr, $msg:literal) => {
35 const _: () = {
36 #[allow(dead_code)]
37 const FAILED_ASSERTION: [&str; 1] = [concat!(
38 "failed assertion: '",
39 stringify!($expr),
40 "' is false: ",
41 $msg,
42 )];
43 #[allow(dead_code)]
44 const CONDITION: bool = $expr;
45 #[allow(dead_code)]
46 const ASSERTION: &str = FAILED_ASSERTION[(!CONDITION) as usize];
47 };
48 };
49}
50
51pub mod ewram;
52pub use ewram::*;
53
54pub mod iwram;
55pub use iwram::*;
56
57pub mod io;
58pub use io::*;
59
60pub mod palram;
61pub use palram::*;
62
63pub mod vram;
64pub use vram::*;
65
66pub mod oam;
67pub use oam::*;
68
69pub mod rom;
70pub use rom::*;
71
72pub mod sram;
73pub use sram::*;