rigz_vm/number/bitor.rs
1use crate::number::Number;
2use std::ops::BitOr;
3
4impl BitOr for &Number {
5 type Output = Number;
6
7 #[inline]
8 fn bitor(self, rhs: Self) -> Self::Output {
9 match (self, rhs) {
10 (Number::Int(i), rhs) => Number::Int(i | rhs.to_int()),
11 (Number::Float(f), rhs) => {
12 Number::Float(f64::from_bits(f.to_bits() | rhs.to_float().to_bits()))
13 }
14 }
15 }
16}