+ 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?

28th Sep 2018, 7:13 PM
Adi Pratama
Adi Pratama - avatar
4 Antworten
+ 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 ^
28th Sep 2018, 7:31 PM
BraveHornet
BraveHornet - avatar
+ 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
29th Sep 2018, 2:00 AM
Chris
Chris - avatar
+ 1
johnny samuel No, that's &&.
29th Sep 2018, 6:56 PM
Chris
Chris - avatar
- 1
& is called AND operator and is true if the both conditions are true else it is false
29th Sep 2018, 4:01 PM
johnny samuel
johnny samuel - avatar