2
0
Isaac Woods 4 жил өмнө
parent
commit
39fbc94a4b
1 өөрчлөгдсөн 21 нэмэгдсэн , 0 устгасан
  1. 21 0
      aml/src/type2.rs

+ 21 - 0
aml/src/type2.rs

@@ -50,6 +50,7 @@ where
             make_parser_concrete!(def_l_greater()),
             make_parser_concrete!(def_l_greater_equal()),
             make_parser_concrete!(def_l_less()),
+            make_parser_concrete!(def_l_less_equal()),
             make_parser_concrete!(def_l_or()),
             make_parser_concrete!(def_package()),
             make_parser_concrete!(def_shift_left()),
@@ -208,6 +209,26 @@ where
         .map(|((), result)| Ok(result))
 }
 
+fn def_l_less_equal<'a, 'c>() -> impl Parser<'a, 'c, AmlValue>
+where
+    'c: 'a,
+{
+    /*
+     * DefLLessEqual := LNotOp(0x92) LGreaterOp(0x94) Operand Operand
+     */
+    opcode(opcode::DEF_L_NOT_OP)
+        .then(opcode(opcode::DEF_L_GREATER_OP))
+        .then(comment_scope(
+            DebugVerbosity::AllScopes,
+            "DefLLessEqual",
+            term_arg().then(term_arg()).map_with_context(|(left_arg, right_arg), context| {
+                let ord = try_with_context!(context, left_arg.cmp(right_arg, context));
+                (Ok(AmlValue::Boolean(ord != Ordering::Greater)), context)
+            }),
+        ))
+        .map(|(((), ()), result)| Ok(result))
+}
+
 pub fn def_package<'a, 'c>() -> impl Parser<'a, 'c, AmlValue>
 where
     'c: 'a,