Skip to content
This repository has been archived by the owner on Dec 29, 2018. It is now read-only.

Commit

Permalink
added function math_raw_le_to_long
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhaskell committed Jan 9, 2014
1 parent b9bff3a commit 4902e24
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions math.axi
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@ define_function long math_raw_be_to_long(char x[4])
return x[1] << 24 + x[2] << 16 + x[3] << 8 + x[4]
}

/**
* Load 4 bytes of little endian data contained in a character array into a long.
*
* Note: Array position 4 should contain MSB / position 1 should contain LSB
*
* @param x a 4 byte character array containg the data to load
* @return a long filled with the passed data
*/
define_function long math_raw_le_to_long(char x[4])
{
return x[4] << 24 + x[3] << 16 + x[2] << 8 + x[1]
}


/**
* Load a float value's IEEE 754 bit pattern into a long.
*
Expand Down

0 comments on commit 4902e24

Please sign in to comment.