answersLogoWhite

0

What is the use of Bitwise operators?

Updated: 10/23/2022
User Avatar

Wiki User

14y ago

Best Answer
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

14y ago
This answer is:
User Avatar

Add your answer:

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

How many bitwise operators are present in Java?

The bitwise & operator performs a bitwise AND operation. The bitwise ^ operator performs a bitwise exclusive OR operation. The bitwise | operator performs a bitwise inclusive OR operation.


What are different type's operators?

The different types of operators are as follows: *Arithmatic operator *Relational operator *Logical operator *Assignment operator *Increment/Decrement operator *Conditional operator *Bitwise operator *Special operator


All the bitwise operators have the same level of precedence in Java true or false?

False: highest precedence & bitwise AND ^ bitwise XOR | bitwise OR lowest precedence


How many types of logical operators in c only?

There are three logical operators in C; AND (&), OR (|), and NOT (^). These are the bitwise versions. The combinatorial versions are &&, , and !.


What is PHP operators?

PHP Operators are syntactical constructs that assign, compare, or modify a value. There are bitwise operators, arithmetic operators, boolean operators, assignment operators, and concatenation operators. There are also a wide variety of functions and class methods which simulate or utilize these operations.


What are the various operators available in c language?

There are eight types of operators which are used in C language.These are- 1.Arithmetic operator 2.Assignment operator 3.Relational operator 4.Increment/Decrement operator 5.Bitwise operator 6.Logical operator 7.Conditional operator 8.Additional operator 1.Arithmetic operator:Arithmetic operators are mathmetical operator.These are addition,Subtraction,Multiplication and divison. 2.Assignment operator:Assignment operators are used to store the result of an expression to a variable.


What is the use of bitwise operator in c plus plus?

They perform bitwise operations like AND (&), OR (|), XOR (^) and NOT (~).


How do you swap two variables using bitwise operators?

a := a XOR b b := a XOR b a := a XOR b it works, but never use it in real programs do you know why its not used in real program??


What are different types of operators?

The different types of operators are as follows: *Arithmatic operator *Relational operator *Logical operator *Assignment operator *Increment/Decrement operator *Conditional operator *Bitwise operator *Special operator


What is use of l in c language?

Bitwise OR.


How-to to add to values in java core without using plus operator?

Though Java, unlike other languages, does not allow you to directly access the core, memory addresses and system variables, it does have binary operators, such as the shifters >>, <<, and the bitwise operators, |, &, ^. Using these operators, ALL calculations in the computer can be done, even your complicated trig functions. Though options are limited in Java, it does provide a simulated access to low level operations. The bitwise operators are in the link below. Look at the link below to see how the computer really does math.


What is the definition of bitwise?

Bitwise operations are those that operate on one or more bits of data, as opposed to larger units of data. For example, in C++, there are the bitwise operators "^" (exclusive or), "&" (and), "|" (or), and "~" (bitwise complement). Using these symbols, it is possible to determine if a bit is set or unset, combine sets of bits, find common bits, or invert all the bits at once. This allows the use of a single field (such as an int variable) to hold multiple pieces of data. Algorithms that concern themselves with saving space, such as compression algorithms, embedded system code, and so on, will often use bitfields instead of entire bytes of data whenever practical.