[英]What is the meaning of $c1 = ($c1 & 0x03) << 4?
Specifically, what does the ($c1 & 0x03) << 4
do? 具体来说,
($c1 & 0x03) << 4
什么作用?
Is 0x03 hex notation? 是0x03十六进制表示法吗?
It does mean first operation do logically AND with HEX value 0x03(that is 3 in HEX or (0011) in Binary).and then left Shift 4 places.example 这确实意味着首先进行逻辑运算,并以HEX值0x03(即HEX中的3或Binary中的(0011))进行逻辑与,然后左移4个位。
let u have $c = 34. then first it performs $c & 3 which is (100010 BITWISE AND 000011) which Gives you (000010) and then It shifts 4 digit on left position and restore new value in $c ie (100000) or 32 in decimal. 让你有$ c =34。然后它首先执行$ c&3,即(100010 BITWISE AND 000011)给你(000010),然后将其左移4位并恢复$ c中的新值,即(100000)或十进制32。
Hope it is Helpful. 希望对您有所帮助。
Thanks 谢谢
这将占用$c1
值的低两位,并将其向左移动4位。
Yes 0x is hex. 是的0x是十六进制。 That is doing a bitwise AND of $c1 and the hex 03 value, then left shifting the result 4 places (powers of 2).
这是对$ c1与十六进制03值进行按位与,然后左移结果4位(2的幂)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.