到大端还是小端? [英] To big endian or to little endian?

查看:72
本文介绍了到大端还是小端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我们暂时忽略目标和源硬件.那么,与大端或小端匹配的端序样式是什么呢?

我只是想就此达成共识/惯例.到目前为止,我收到的最佳指导是取决于情况",因此请务必指定.没关系.我会去做.

但是,在这种情况下,无需采取任何一种方式.没有遗产,所以我想:对于当前和新兴的硬件,最干净的选择是什么."

解决方案

实际上答案取决于它

如果您只想选择一个选项,那么由于在Big Endian中高字节在前,因此您始终可以从第一个字节开始检查正负.

let's say that we ignore the target and source hardware for a moment. So, what's the better endian style to go with -- big or small?

I'm just trying to go with consensus / convention on this one. The best guidance I've received so far is "it depends" so always specify. That's fine. I'll do that.

However, in this situation there is no need to be one way or the other. There's no legacy, so I thought, "what would be the cleanest choice for current & emerging hardware."

解决方案

Actually the answer is it depends

If you just want a choice then Since in Big Endian high order byte comes first ,you can always check positive or negative from the first byte.

这篇关于到大端还是小端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆