summaryrefslogtreecommitdiff
path: root/src/arm32/flag/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/arm32/flag/mod.rs')
-rw-r--r--src/arm32/flag/mod.rs46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/arm32/flag/mod.rs b/src/arm32/flag/mod.rs
index 33755b7..b24e103 100644
--- a/src/arm32/flag/mod.rs
+++ b/src/arm32/flag/mod.rs
@@ -48,3 +48,49 @@ impl<const C: char> Display for Flag<C> {
Ok(())
}
}
+
+impl<const C: char> From<bool> for Flag<C> {
+ #[inline(always)]
+ fn from(value: bool) -> Self {
+ if value {
+ Self::On
+ } else {
+ Self::Off
+ }
+ }
+}
+
+impl<const C: char> From<Flag<C>> for bool {
+ #[inline(always)]
+ fn from(value: Flag<C>) -> Self { value.is_on() }
+}
+
+impl<const C: char> From<Flag<C>> for u128 {
+ #[inline(always)]
+ fn from(value: Flag<C>) -> Self { Self::from(value.is_on()) }
+}
+
+impl<const C: char> From<Flag<C>> for u16 {
+ #[inline(always)]
+ fn from(value: Flag<C>) -> Self { Self::from(value.is_on()) }
+}
+
+impl<const C: char> From<Flag<C>> for u32 {
+ #[inline(always)]
+ fn from(value: Flag<C>) -> Self { Self::from(value.is_on()) }
+}
+
+impl<const C: char> From<Flag<C>> for u64 {
+ #[inline(always)]
+ fn from(value: Flag<C>) -> Self { Self::from(value.is_on()) }
+}
+
+impl<const C: char> From<Flag<C>> for u8 {
+ #[inline(always)]
+ fn from(value: Flag<C>) -> Self { Self::from(value.is_on()) }
+}
+
+impl<const C: char> From<Flag<C>> for usize {
+ #[inline(always)]
+ fn from(value: Flag<C>) -> Self { Self::from(value.is_on()) }
+}