浏览代码

Allow conversion of integers to booleans by comparing to 0

Isaac Woods 4 年之前
父节点
当前提交
7ee3f5ce99
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      aml/src/value.rs

+ 1 - 0
aml/src/value.rs

@@ -175,6 +175,7 @@ impl AmlValue {
     pub fn as_bool(&self) -> Result<bool, AmlError> {
         match self {
             AmlValue::Boolean(value) => Ok(*value),
+            AmlValue::Integer(value) => Ok(*value != 0),
             _ => Err(AmlError::IncompatibleValueConversion),
         }
     }