简体   繁体   中英

What is the meaning of $c1 = ($c1 & 0x03) << 4?

Specifically, what does the ($c1 & 0x03) << 4 do?

Is 0x03 hex notation?

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

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.

Hope it is Helpful.

Thanks

这将占用$c1值的低两位,并将其向左移动4位。

Yes 0x is hex. That is doing a bitwise AND of $c1 and the hex 03 value, then left shifting the result 4 places (powers of 2).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM