我在Windows 8.1下运行Julia 1.0.2。
下面的内容让我相信Julia以"little-endian“的方式对待我的机器:
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.
基于以上,下面的位串示例对我来说是有意义的。两者的最低有效字节都在左边,正如我所期望的小端字节顺序:
julia> bitstring(1.0)
"0011111111110000000000000000000000000000000000000000000000000000"
julia> bitstring(Char(1))
"00000001000000000000000000000000"
但是,下面的示例似乎是按大端顺序排列的,最低有效字节在右侧:
julia> bitstring(1)
"0000000000000000000000000000000000000000000000000000000000000001"
我是不是很困惑?有什么建议或解释吗?
https://stackoverflow.com/questions/53656963
复制相似问题