Question

In: Computer Science

One possible performance enhancement is to do a shift and add instead of an actual multiplication....

One possible performance enhancement is to do a shift and add instead of an actual multiplication. Since 9 × 6, for example, can be written (2 × 2 × 2 + 1) × 6, we can calculate 9 × 6 by shifting 6 to the left 3 times and then adding 6 to that result. Show the best way to calculate 0x33×0x55 using shifts and adds . Assume both inputs are 16-bit unsigned integers

Solutions

Expert Solution

Step1

Numbers are 0x33 and 0x55

33hex= 3 x 16 + 3 = 51 =32 +16 + 3 = 25 + 24 + 21 +1 = 51

and

55hex= 5 x 16 + 5 = 85 =64 +16 + 4 + 1 = 26+ 24 + 22 +1 = 51

Step2

It could be written as

33hex X 55hex = ( 25 + 24 + 21 +1) X 55hex

Step 3

follow the below steps:

  1. Set result = 0.
  2. Shift 55hex 5 times to the left and add it to the result.
  3. Shift 55hex 4 times to the left and add it to the result.
  4. Shift 55hex 1 times to the left and add it to the result.
  5. Add 55hex to the result.

Step 4

55hex = (01010101)two

assuming result is a 16 bit number

performing the above steps present in step 3

Steps Add Result
1 ------ 0000000000000000
2 101010100000 0000101010100000
3 10101010000 0000111111110000
4 10101010 0001000010011010
5 101010 0001000011101111

Step 5

Final result is:

(0001000011101111)two = ( 10EF )hex  

(0001000011101111)two = ( 4335 )ten  

Hence 0x33 × 0x55 = ( 10EF )hex   = ( 4335 )ten  


Related Solutions

Prove that there is only one possible multiplication table for G if G has exactly 1,...
Prove that there is only one possible multiplication table for G if G has exactly 1, 2, or 3 elements. Analyze the possible multiplication tables for groups with exactly 4 elements, and show that there are two distinct tables, up to reordering the elements of G. Use these tables to prove that all groups with < 4 elements are commutative. (You are welcome to analyze groups with 5 elements using the same technique, but you will soon know enough about...
JAVA- How do I edit the following code as minimally as possible to add this method...
JAVA- How do I edit the following code as minimally as possible to add this method for calculating BMI? BMI Method: public static double calculateBMI(int height, int weight) { double BMI = (((double) weight) * 0.453592d) / ((((double) height) * 0.0254) * (((double) height) * 0.0254)); Format f = new DecimalFormat("##.######"); return (f.format(BMI)); } Code: import java.text.DecimalFormat; import java.util.Scanner; public class test2 { public static void main(String[] args) { DecimalFormat f = new DecimalFormat("##.0"); Scanner reader = new Scanner(System.in); System.out.printf("%10s...
how do the terms second shift and intensive mothering relate to one another?
how do the terms second shift and intensive mothering relate to one another?
How do ethnocentrism and discrimination relate to one another? Is it possible to be ethnocentric but...
How do ethnocentrism and discrimination relate to one another? Is it possible to be ethnocentric but not engage in discrimination?
please do as many as possible 2.25: Each point in the plane is randomly assigned one...
please do as many as possible 2.25: Each point in the plane is randomly assigned one of two colors, red or green. Show that for any real number l > 0, there exist two points on the plane a distance l apart, that are either both assigned red or both assigned green. (Hint: consider equilateral triangles.) 2.18: Suppose you have a circle of radius 1 with center at the origin. Suppose that 200 points are picked on the circle, of...
Assignment Details Scenario One of the possible reasons that hunters and gatherers do not work more...
Assignment Details Scenario One of the possible reasons that hunters and gatherers do not work more than they do may be to avoid overexploitation of their environment. Think about this: overhunting might allow people to feast for a few days, but over the long run, the effect would simply be to destroy the local game supplies. Hunters and gatherers also demonstrate less patriarchy and ownership taboos than industrial society members. You will explore these differences in a PowerPoint presentation for...
Which one do you think will influence the employee the most (Money, Social recognition, and Performance...
Which one do you think will influence the employee the most (Money, Social recognition, and Performance Feedback)
Identify ways to make performance evaluations more effective. Do you believe one of your suggestions is...
Identify ways to make performance evaluations more effective. Do you believe one of your suggestions is of higher priority than the others? Explain. Would you rather work for an organization where everyone knows what others are earning or an organization where this information is kept secret? Why? Some medical experts believe that regular exercises result in better health, improved conditioning and greater tolerance of stressful situations. What would you think about being employed by a company that required you to...
Required references 1- Identify ways to make performance evaluations more effective. Do you believe one of...
Required references 1- Identify ways to make performance evaluations more effective. Do you believe one of your suggestions is of higher priority than the others? Explain. 2- Would you rather work for an organization where everyone knows what others are earning or an organization where this information is kept secret? Why? 3- Some medical experts believe that regular exercises result in better health, improved conditioning and greater tolerance of stressful situations. What would you think about being employed by a...
Considering the structure and composition of SARS-CoV-2, list possible antigens for antibody binding. Which one do...
Considering the structure and composition of SARS-CoV-2, list possible antigens for antibody binding. Which one do you think would be the most effective for a diagnostic serological assay?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT