Posted (Aug. 13, 2010, 4:21 p.m.)
-
src/base/intmath.hh (Diff revision 1) -
This isn't particularly efficient. A better algorithm would be to square n over and over and multiply it in if the appropriate bit in e is set. I'm surprised there isn't already a standard library function to do this, but I wasn't able to find one quickly with Google. Also, by setting result = 1, e == 0 doesn't need to be a special case.
Posted (Aug. 14, 2010, 12:28 a.m.)
-
src/dev/arm/timer_sp804.cc (Diff revision 1) -
Is this right? What are the possible values of control.timerPrescale? I don't think there are many integer powers of 16 that generate valid shift amounts...
Posted (Aug. 17, 2010, 7:56 a.m.)
-
src/base/intmath.hh (Diff revision 1) -
How about a warning if it's called with an exponent > 20?
-
src/dev/arm/timer_sp804.cc (Diff revision 1) -
You're right... this is what I get for trying to be cute... time = time / clock / power(16, control.timerPrescale); is what I'm after
Posted (Aug. 17, 2010, 11:38 a.m.)
-
src/base/intmath.hh (Diff revision 1) -
There is an overflow that wouldn't be caught. If n >= 18446744073709551615 the overflow wouldn't be caught. That probably isn't a reasonable case though... If you would prefer, n could be a 32bit int which would take care of the problem.
