Definition: | atom a = bytes_to_int(sequence s, bool signed=true) |
Description: | Convert a sequence of byte values to an atom. The elements of s should be in the order expected on the 386+, i.e. least-significant byte first. |
Comments: | The result could be greater than the integer type allows, so you should
assign it to an atom.
s would normally contain positive values that have been read using peek() from 1, 2, 4, or 8 consecutive memory locations. By default the result will be a signed integer, honouring the sign bit, but you can treat it as unsigned by passing 0 (false) as the second parameter. |
Example: |
atom int32 int32 = bytes_to_int({37,1,0,0}) -- int32 is 37 + 256*1 = 293 |
See Also: | int_to_bytes, bits_to_int, peek, poke |