Updated the library to use the new Array interface.
This commit is contained in:
parent
16d073b1f9
commit
0f9b3b56c5
@ -105,7 +105,7 @@ macro_rules! unpack_big_endian
|
||||
buffer = ::spellbook::components::Array::with_capacity($bytes);
|
||||
for i in 0..$bytes
|
||||
{
|
||||
buffer.push(($value >> (($bytes - i) - 1) * 8) as u8);
|
||||
buffer.insert_element(($value >> (($bytes - i) - 1) * 8) as u8);
|
||||
}
|
||||
|
||||
// Return the buffer of bytes that represent this value.
|
||||
@ -127,7 +127,7 @@ macro_rules! unpack_little_endian
|
||||
buffer = ::spellbook::components::Array::with_capacity($bytes);
|
||||
for i in 0..$bytes
|
||||
{
|
||||
buffer.push(($value >> (i * 8)) as u8);
|
||||
buffer.insert_element(($value >> (i * 8)) as u8);
|
||||
}
|
||||
|
||||
// Return the buffer of bytes that represent this value.
|
||||
|
@ -151,8 +151,12 @@ impl Transmutable for u8
|
||||
#[allow(unused_variables)]
|
||||
fn as_endian_bytes(&self, endianess: Endianess) -> Array<u8>
|
||||
{
|
||||
// A single byte has no endian form.
|
||||
vec![*self]
|
||||
let mut bytes: Array<u8>;
|
||||
|
||||
bytes = Array::with_capacity(1usize);
|
||||
bytes.insert_element(*self);
|
||||
|
||||
bytes
|
||||
}
|
||||
|
||||
fn determine_byte_size(&self) -> usize
|
||||
@ -259,7 +263,12 @@ impl Transmutable for i8
|
||||
#[allow(unused_variables)]
|
||||
fn as_endian_bytes(&self, endianess: Endianess) -> Array<u8>
|
||||
{
|
||||
vec![*self as u8]
|
||||
let mut bytes: Array<u8>;
|
||||
|
||||
bytes = Array::with_capacity(1usize);
|
||||
bytes.insert_element(*self as u8);
|
||||
|
||||
bytes
|
||||
}
|
||||
|
||||
fn determine_byte_size(&self) -> usize
|
||||
|
Loading…
x
Reference in New Issue
Block a user