&是什么意思操作员? [英] What is the meaning of the & operator?
本文介绍了&是什么意思操作员?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在以下代码中:
Expression<Func<int, bool>> isOdd = i => (i & 1) == 1;
... (i & 1) == 1
是什么意思?
...what is the meaning of (i & 1) == 1
?
推荐答案
Bitwise AND. In this case, checking whether the last bit in i
is set. If it is, it must be an odd number since the last bit represents 1 and all other bits represent even numbers.
这篇关于&是什么意思操作员?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文