valheim_asm/isa/data.rs
1/// Bounded integer within the range `[0, MAX)`.
2#[derive(Copy, Clone, Debug, Eq, PartialEq)]
3pub struct Fin<const MAX: u32>(u32);
4
5impl<const MAX: u32> Fin<MAX> {
6 pub const fn new(value: u32) -> Self {
7 assert!(value < MAX);
8 Self(value)
9 }
10
11 #[inline(always)]
12 pub fn value(self) -> u32 {
13 self.0
14 }
15}
16
17pub(crate) mod workaround {
18 pub struct If<const B: bool>;
19 pub trait True {}
20 impl True for If<true> {}
21}