Redian新闻
>
one question about bit operator
avatar
one question about bit operator# JobHunting - 待字闺中
c*g
1
what's the different between
n >> 1;
and
n >>= 1;
I am quite confused about this
avatar
d*e
2
the second one should be like
a = n >> 1;
n = a;

【在 c***g 的大作中提到】
: what's the different between
: n >> 1;
: and
: n >>= 1;
: I am quite confused about this

avatar
z*4
3
第二个需要temporary memory?

【在 c***g 的大作中提到】
: what's the different between
: n >> 1;
: and
: n >>= 1;
: I am quite confused about this

avatar
p*i
4
n >> 1 is an expression that does not change the value of n.
n >>= 1 is equivalent to n = n >> 1, which basically assigns the result of
the expression (n>>1) back to n
At the machine level, "n>>=1" can be a single instruction (depending the
instruction set)
n >> 1 may need temporary storage. again, these stuff heavily depend on the
architecture and the instruction set.

【在 c***g 的大作中提到】
: what's the different between
: n >> 1;
: and
: n >>= 1;
: I am quite confused about this

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。