浏览代码

Add note about why we have to do `-1` in one place

Michael Melanson 4 年之前
父节点
当前提交
e27ff4951d
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      aml/src/resource.rs

+ 3 - 1
aml/src/resource.rs

@@ -303,7 +303,9 @@ pub struct IrqDescriptor {
 
 fn irq_format_descriptor(bytes: &[u8]) -> Result<Resource, AmlError> {
 
-    match bytes.len() - 1 { // TODO check this
+    // We do `- 1` here so the arms below match specification. It doesn't 
+    // count byte 0 for some reason.
+    match bytes.len() - 1 { 
         0..=1 => Err(AmlError::ResourceDescriptorTooShort),
         2 => {
             let irq = LittleEndian::read_u16(&bytes[1..=2]);