位运算符和"字节顺序" [英] Bitwise operators and "endianness"

查看:98
本文介绍了位运算符和"字节顺序"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在所有问题与位操作?无论是<一个href=\"http://stackoverflow.com/questions/1036141/bitwise-not-operator-in-c-with-regards-to-little-endian-and-big-endian\">logical或转移?

Does endianness matter at all with the bitwise operations? Either logical or shifting?

我正在做作业关于位运算符,我不能作出正面或反面就可以了,我想我已经相当挂了字节序。也就是说,我使用的是小端机(最喜欢的),但是,这需要考虑或者是一个浪费的事实?

I'm working on homework with regard to bitwise operators, and I can not make heads or tails on it, and I think I'm getting quite hung up on the endianess. That is, I'm using a little endian machine (like most are), but does this need to be considered or is it a wasted fact?

在的情况下它的事项,我使用C

In case it matters, I'm using C.

推荐答案

字节序只对内存中的数据的布局问题。只要数据是由所述处理器加载要操作上,字节序是完全无关紧要。班次,位运算等执行你所期望的(逻辑布局为低位向高数据)的字节顺序无关。

Endianness only matters for layout of data in memory. As soon as data is loaded by the processor to be operated on, endianness is completely irrelevent. Shifts, bitwise operations, and so on perform as you would expect (data logically laid out as low-order bit to high) regardless of endianness.

这篇关于位运算符和&QUOT;字节顺序&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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