Quote:
Originally Posted by kamocat
I've seen the AND function used with numeric datatypes, and I really don't understand:
What the heck does it mean like that? Does it convert the integers into boolean arrays, perform the function as if on an array, and then convert them back?
Thanks!
|
I believe you have the right idea.
All processors store numbers as groups of bits. Performing an AND on numeric datatypes performs the AND operation on these sets of bits. The way the processor sees it no conversion is necessary, the data is already right there in the correct format to do a logical AND bit by bit.
This is often useful to grab parts of a number, usually the most or least significant bits.