masking - Conversion from int to 4 byte unsigned int -


i'm trying convert int 4 byte unsigned ints. reading post , i'm not sure comparison does. know sub mask, i'm not sure when use & , when use |. lets use number 6 example, if lsb number 6. why

6 & 0xff// know comparing 11111111  

when use or operator? i'm still not sure how use & nor |

x & 0xff set bits of x 0 except last byte (which stays same). if had used bitwise or (|), leave bits of x set, , set bits of last byte 1.

typically, comparison (x & 0xff) == x. make sure first 3 bytes of x 0.


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -