luaur_code_gen/functions/
compare_ir_utils.rs1use crate::enums::ir_condition::IrCondition;
2use crate::macros::codegen_assert::CODEGEN_ASSERT;
3
4pub fn compare_f64_f64_ir_condition(a: f64, b: f64, cond: IrCondition) -> bool {
5 match cond {
8 IrCondition::Equal => a == b,
9 IrCondition::NotEqual => a != b,
10 IrCondition::Less => a < b,
11 IrCondition::NotLess => !(a < b),
12 IrCondition::LessEqual => a <= b,
13 IrCondition::NotLessEqual => !(a <= b),
14 IrCondition::Greater => a > b,
15 IrCondition::NotGreater => !(a > b),
16 IrCondition::GreaterEqual => a >= b,
17 IrCondition::NotGreaterEqual => !(a >= b),
18 _ => {
19 CODEGEN_ASSERT!(false, "Unsupported condition");
20 false
21 }
22 }
23}