answersLogoWhite

0

Answer

The bitwise operators treat a number as its binary equivalent rather than as a simple boolean value.

For most programming languages, a value of zero is considered FALSE and all other values are TRUE

Thus, 8 AND 11 returns TRUE as does 3 OR 0

In bitwise analysis, each binary bit of the digit are compared. The number of bits compared will depend on the type of number.

In C, a CHAR is usually 8 bits and can hold the binary numbers 0 to 255.

If we compare 8 (00001000) and 19 (00010011) with bitwise operators, we get different results from Boolean operators:

8 BITWISE AND 19 returns 0 (each bit in the response is set to 1 if both equivalent bits compared are 1) but 8 BITWISE OR 19 will return 27.

The utility of these methods is in identifying binary data. For example, all files on a PC have the characteristics 'Hidden' 'Read Only' 'Archive' and 'System' which can be set or unset using bitwise operations on a single byte of data. In truth this is a throwback to the days of small memory capacities where saving the odd byte was essential.

There are more uses of bitwise, especially in graphics, where XOR can be used to paint a Sprite image to display it and then be used again to return a background to its former settings. I regret I lack the skill to explain this better.

User Avatar

Wiki User

15y ago

Still curious? Ask our experts.

Chat with our AI personalities

SteveSteve
Knowledge is a journey, you know? We'll get there.
Chat with Steve
TaigaTaiga
Every great hero faces trials, and you—yes, YOU—are no exception!
Chat with Taiga
CoachCoach
Success isn't just about winning—it's about vision, patience, and playing the long game.
Chat with Coach

Add your answer:

Earn +20 pts
Q: What is the use of Bitwise operators?
Write your answer...
Submit
Still have questions?
magnify glass
imp