+ 11
What's the meaning of '&' symbol? For example: "iterator = (iterator + 3) & 7;"
this instruction iterator = (iterator + 3) & 7; is in line 236 inside: https://github.com/djm34/sgminer-msvc2015/blob/master/kernel/lyra2Z.cl is it true that '&' symbol is to convert the number to binary automatically and do bitwise operation after that?
4 Answers
+ 8
& is a bitwise operation.
x| y| value
âââââ
0| 0| false
0| 1| false
1| 0| false
1| 1| true
For example:
iterator= 0110 & 1011
so iterator is 0010
Other bitwise operations are | and ^
+ 3
Your computer doesn't need convert the number because your hardware already stores everything in binary.
The result will be decimal again, i.e. 10 & 7 == 2
+ 1
johnny samuel No, that's &&.
- 1
& is called AND operator and is true if the both conditions are true else it is false