Code: Select all
rem + ------------------------------------------------------------------------ +
rem | Convert a 4 byte internal representation of a long integer into a number |
rem | No check on the length of n$, which must be four bytes exactly! |
rem + ------------------------------------------------------------------------ +
rem | V0.02, pjw, 2024 Jul 31 |
rem + ------------------------------------------------------------------------ +
:
DEFine FuNction LongInt(n$)
LOCal i%, t
t = CODE(n$(1))
FOR i% = 2 TO 4: t = t * 256 + CODE(n$(i%))
IF t = 2 ^ 32: RETurn -1: REMark Rounding "error"?
IF t > $7FFFFFFF: RETurn t - 2 ^ 32
RETurn t
END DEFine LongInt
: