











Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Chanchal Mahanthapa delivered this lecture at Chandra Shekhar Azad University of Agriculture and Technology for Programming and Computer Architecture. It includes: Computer, Programming, XOR, Operations, Bitwise, Operators, Signed, Integer, Types, Shift
Typology: Slides
1 / 19
This page cannot be seen from the preview
Don't miss anything!
docsity.com
(^2) docsity.com
4
docsity.com
5
docsity.com
on signed integer types can vary between different systems and it depends onyour compiler. In some cases it will fill
‘0’^ bits at the left to
fill in the vacated bit positions. In other cases the sign bit is propagated tothe right so
‘1’^ bit fills the vacated bit positions.
(^7) docsity.com
char
, just to show how it works.
(^8) docsity.com
Logical Operations on Bit Patterns Operator
Description
-^
Bitwise complement operator.
This is a unary operator that
will invert the bits to its operand so 1 becomes 0 and 0becomes 1. &^
Bitwise AND operator which will AND the correspondingbits in its operands. If corresponding bits are both 1 thenresulting bit is 1, otherwise it is 0. ^^
Bitwise exclusive OR operator (XOR) if corresponding bitsare different e.g. 1 and 0 result will be 1 otherwise if bits aresame e.g. 0 and 0 result will be 0. |^
Bitwise OR operator. If corresponding bits are 0 and 0 theresulting bit will be 0, otherwise it is 1.
(^10) docsity.com
2- (^11) docsity.com
. ^ Here one operand, called the
mask
,
determines which part of the otheroperand will affect the result. In case of AND operation, maskingproduces a result that is a partial replicaof the one operand, with 0s occupying thenonduplicated positions.
2- (^13) docsity.com
bit map
,
◦^ A string of bits in which each bit representsthe presence or absence of a particular object ◦^ We have encountered bit maps in context ofrepresenting images, where each bit isassociated with a pixel.
2- (^14) docsity.com
(^11110000) OR 10101010^11111010
2- (^16) docsity.com
2- (^17) docsity.com
(^19) docsity.com