【发布时间】:2019-05-08 11:28:39
【问题描述】:
我在 Windows 8.1 下运行 Julia 1.0.2。
以下内容让我相信 Julia 以“小端”方式对待我的机器:
julia> VERSION
v"1.0.2"
julia> ENDIAN_BOM
0x04030201
help?> ENDIAN_BOM
search: ENDIAN_BOM
ENDIAN_BOM
The 32-bit byte-order-mark indicates the native byte order of the host machine. Little-endian
machines will contain the value 0x04030201. Big-endian machines will contain the value
0x01020304.
基于上述,下面的位串示例对我来说很有意义。两者都有最不重要的字节,在左边,正如我对 little-endian 字节顺序所期望的那样:
julia> bitstring(1.0)
"0011111111110000000000000000000000000000000000000000000000000000"
julia> bitstring(Char(1))
"00000001000000000000000000000000"
但是,下面的例子似乎是大端顺序,最低有效字节在右边:
julia> bitstring(1)
"0000000000000000000000000000000000000000000000000000000000000001"
我很困惑吗?有什么建议或解释吗?
【问题讨论】:
标签: julia