Print the word size and endianness of the host machine.

See also: Variable size/Get

with javascript_semantics
function endianness()
    if platform()=JS then
        return "n/a (web browser)"
    end if
    atom m4 = allocate(4)
    poke4(m4,#01020304)
    integer b1 = peek1s(m4)
    free(m4)
    if b1=#01 then
        return "big-endian"
    elsif b1=#04 then
        return "little-endian"
    else
        return "???"
    end if
end function
 
printf(1,"Endianness: %s\n",{endianness()})
printf(1,"Word size: %d bytes/%d bits\n",{machine_word(),machine_bits()})
