由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - one question about bit operator
相关主题
c++ class default functions?某银行的笔试题
C++: 如何对const data member做assignment?还是基础题
Q in C/C++IE这个方向怎么样? (转载)
面试题求助面试有个人问我++i和i++哪个快
做个关于引用的题目请问一道很难的面试题
问个关于c++ auto_pter的问题what is regular expression's meaning?
请问一道c++题目zenefits店面 -已挂了
又问几个c语言编程的题目这道题怎么做的?
相关话题的讨论汇总
话题: about话题: operator话题: bit话题: question
进入JobHunting版参与讨论
1 (共1页)
c***g
发帖数: 472
1
what's the different between
n >> 1;
and
n >>= 1;
I am quite confused about this
d**e
发帖数: 6098
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

z****4
发帖数: 194
3
第二个需要temporary memory?

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

p*i
发帖数: 411
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

1 (共1页)
进入JobHunting版参与讨论
相关主题
这道题怎么做的?做个关于引用的题目
C++ 一小题问个关于c++ auto_pter的问题
再问一道ms的面试题请问一道c++题目
Bloomberg phone interview (intern)又问几个c语言编程的题目
c++ class default functions?某银行的笔试题
C++: 如何对const data member做assignment?还是基础题
Q in C/C++IE这个方向怎么样? (转载)
面试题求助面试有个人问我++i和i++哪个快
相关话题的讨论汇总
话题: about话题: operator话题: bit话题: question