How to use bitmask? [closed]
问题 How do i use it in C++ ? when is it useful to use ? Please give me an example of a problem where bitmask is used , how it actually works . Thanks! 回答1: Bit masking is "useful" to use when you want to store (and subsequently extract) different data within a single data value. An example application I've used before is imagine you were storing colour RGB values in a 16 bit value. So something that looks like this: RRRR RGGG GGGB BBBB You could then use bit masking to retrieve the colour