01-02-2014, 08:30 PM
Hey guys, I have a question that's been bugging me for a pretty long time and I can't figure out the answer . As for a background, I was thinking about Bin-BCD, and found dividing by ten/hundred and finding the remainder, would work perfectly. Division by ten was easy by bit shifting, but you had multiply that number back by ten, and subtract from the original value to find the remainder.
Example:
97/10
9-tens
9x10 = 90
97-90
7- ones
That's the longer way of doing this taking around 14 ticks. That brings me back to the question, is there an easier way to find the remainder? Say, how could you know the remainder of 16/10 would be 6 without actually dividing or doing the long multiplication back? Thanks
Example:
97/10
9-tens
9x10 = 90
97-90
7- ones
That's the longer way of doing this taking around 14 ticks. That brings me back to the question, is there an easier way to find the remainder? Say, how could you know the remainder of 16/10 would be 6 without actually dividing or doing the long multiplication back? Thanks