Define bitwise-shift operators, C/C++ Programming

Assignment Help:

Define Bitwise-Shift Operators?

The shift operators perform suitable shift by operator on the right to the operator on the left. The right operator should be positive. The vacated bits are filled with zero that is there is NO wrap around.

For example: x << 2 shifts the bits in x by 2 places to the left.

So:

if x = 00000010 (binary) or 2 (decimal)

then:

or

609_Define Bitwise-Shift Operators.png

0 (decimal)

Also: if x = 00000010 (binary) or 2 (decimal)

or

1379_Define Bitwise-Shift Operators 1.png

8 (decimal)

Consequently a shift left is equivalent to a multiplication by 2.  Likewise a shift right is equal to division by 2 

NOTE: Shifting is much faster in comparison of actual multiplication (*) or division (/) by 2 thus if you want fast multiplications or division by 2 use shifts.


Related Discussions:- Define bitwise-shift operators

Change to palindrome, A palindrome is a string that reads the same from bot...

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

Compiler related, Please give me a programming code of first & follow wit...

Please give me a programming code of first & follow with c or c++ laqnguage .When anyone give me the programming code of first & follow please explain every lines with the help

Friendly function and rules of friend function, F r i e n dly Function...

F r i e n dly Function: A class can have public members and private members.   The public member can be used through the class using dot operator.   Where as private me

C program to check prime numbers , C Program to check PRIME NUMBERS   ...

C Program to check PRIME NUMBERS   main() {           int i,k,r,flag;           clrscr();           printf("ENTER THE NO. TO CHECK IT IS PRIME OR NOT: ");

#, YOU HAVE GIVEN THE MARKED UP PRICE OF 80% AND DISCOUNT PRICE OF 10% THEN...

YOU HAVE GIVEN THE MARKED UP PRICE OF 80% AND DISCOUNT PRICE OF 10% THEN FIND THE SELLING PRICE

Big o notation, The probabilistic Hough transform uses random sampling inst...

The probabilistic Hough transform uses random sampling instead of an accumulator array. In this approach the number of random samples r, is not specified in the OpenCV call, but is

Single string programme, write a programme that allows a user to enter 5 di...

write a programme that allows a user to enter 5 distinct words and returns them as a single string

Change to palindrome, A palindrome is a string that reads the same from bot...

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

Program to print a series, Write a program called Series that will print/di...

Write a program called Series that will print/display a series of numbers starting with 1 and ending with the last number that is less than 30. The series should include only odd n

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd