Skip to content
Snippets Groups Projects
Unverified Commit c6ecf105 authored by Connor Wood's avatar Connor Wood
Browse files

Converted Integer to Buffer

parent a70b2655
No related branches found
No related tags found
1 merge request!48Fully implemented AML parser, some amendments to ACPI infrastructure
...@@ -132,6 +132,21 @@ impl AmlValue { ...@@ -132,6 +132,21 @@ impl AmlValue {
pub fn get_as_buffer(&self) -> Result<Vec<u8>, AmlError> { pub fn get_as_buffer(&self) -> Result<Vec<u8>, AmlError> {
match *self { match *self {
AmlValue::Buffer(ref b) => Ok(b.clone()), AmlValue::Buffer(ref b) => Ok(b.clone()),
AmlValue::Integer(ref i) => {
let mut v: Vec<u8> = vec!();
let mut i = i.clone();
while i != 0 {
v.push((i & 0xFF) as u8);
i >>= 8;
}
while v.len() < 8 {
v.push(0);
}
Ok(v)
},
_ => Err(AmlError::AmlValueError) _ => Err(AmlError::AmlValueError)
} }
} }
...@@ -174,7 +189,6 @@ impl Method { ...@@ -174,7 +189,6 @@ impl Method {
} }
pub fn get_namespace_string(current: String, modifier_v: AmlValue) -> Result<String, AmlError> { pub fn get_namespace_string(current: String, modifier_v: AmlValue) -> Result<String, AmlError> {
// TODO: Type error if modifier not string
let mut modifier = modifier_v.get_as_string()?; let mut modifier = modifier_v.get_as_string()?;
if current.len() == 0 { if current.len() == 0 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment