Briefly explain bitwise multiplication
Chapter8: Data And Network Communication Technology
Section: Chapter Questions
Problem 34VE
Related questions
Question
Briefly explain bitwise multiplication
Expert Solution
Step 1
Bitwise multiplication can be done in 2 methods
1. left shift operator: In this the number is represented in binary and the multiplication is done by powers of 2 obtained using left shift operator
2. using Russian Peasant Algorithm: The idea is to double greater number and halve the lesser number until the lesser number becomes odd. Then add it to the first.
The program is written in python
Step 2
def russianPeasant(a, b):
res = 0
while (b > 0):
if (b & 1):
res = res + a
a = a << 1
b = b >> 1
return res
print(russianPeasant(18, 8))
Step by step
Solved in 3 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning