소스 검색

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),
         }
     }