Read: 598 times
|#187952 - Right Shift Rounding Recommendations|
So, I am trying to right shift a signed short, which is causing me the number to always round down (which makes sense). I am trying to decide the best way to deal with the issue as it is creating cascading problems for my program. I'd rather not divide as it takes many more calculations (16, if I remember correctly) to do a division calculation but only a single cycle to do a right shift. Since I right shift in a number of places (and I'd like the function to take as little time as possible), the time it takes to complete the division cycles adds up quick.
My question is is there another way or a workaround for this problem or am I stuck using using division for this?
Any help you can give me would be GREATLY appreciated. Thanks!
|Right Shift Rounding Recommendations||Jeremy Brookley||07/16/12 10:30|
|add before shift||Per Westermark||07/16/12 11:12|
|Guard digits?||Oliver Sedlacek||07/16/12 22:25|
|How does this look?||Jeremy Brookley||07/17/12 05:21|
|Nice but..||Oliver Sedlacek||07/18/12 09:55|
|Please elaborate further.||Christoph Franck||07/19/12 04:33|
|Jeremy Brookley||07/19/12 10:02|
|I do not know how you managed, but||Erik Malund||07/19/12 12:48|
|breaking the rules, one forum at a time . . .||Jeremy Brookley||07/19/12 13:59|