浏览代码

Handle conversions to buffers from as_type

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

+ 1 - 2
aml/src/value.rs

@@ -275,7 +275,6 @@ impl AmlValue {
         match self {
             AmlValue::Integer(value) => Ok(*value),
             AmlValue::Boolean(value) => Ok(if *value { u64::max_value() } else { 0 }),
-
             AmlValue::Buffer(ref bytes) => {
                 /*
                  * "The first 8 bytes of the buffer are converted to an integer, taking the first
@@ -293,7 +292,6 @@ impl AmlValue {
                     i
                 }))
             }
-
             /*
              * Read from a field or buffer field. These can return either a `Buffer` or an `Integer`, so we make sure to call
              * `as_integer` on the result.
@@ -398,6 +396,7 @@ impl AmlValue {
         // TODO: implement all of the rules
         match desired_type {
             AmlType::Integer => self.as_integer(context).map(|value| AmlValue::Integer(value)),
+            AmlType::Buffer => self.as_buffer(context).map(|value| AmlValue::Buffer(value)),
             AmlType::FieldUnit => panic!(
                 "Can't implicitly convert to FieldUnit. This must be special-cased by the caller for now :("
             ),