Here we learn an easy method of doing subtraction of two binary numbers.
The method uses binary addition to find the subtraction result.
NOTE: the 'INVERT' mentioned in the video means bit inversion (flip).
Given two binary numbers A and B, if we want to find A - B.
The first step would be to find 2s complement of B which is C.
Now you can do binary addition of A and C. In the output of the addition, discard the extra bit you find. This output will be the required result of A - B.
See subtraction problem here: • How to Subtract 1 using Bit Manipulat...
See Bit Manipulation Interview Preparation Series here:
• Bit Manipulation Interview Series
You could follow us on Facebook and Instagram:
Facebook : / firmwarecode
Instagram : / firmwarecode
#bitmanipulation #bitalgorithm