Does my AMD-based machine use little endian or big endian?

前端 未结 7 1023
鱼传尺愫
鱼传尺愫 2020-12-05 02:54

I\'m going though a computers system course and I\'m trying to establish, for sure, if my AMD based computer is a little endian machine? I believe it is because it

7条回答
  •  没有蜡笔的小新
    2020-12-05 03:12

    Assuming you have Python installed, you can run this one-liner, which will print "little" on little-endian machines and "big" on big-endian ones:

    python -c "import struct; print 'little' if ord(struct.pack('L', 1)[0]) else 'big'"
    

提交回复
热议问题