Re:Why C Is Not Assembly
by mansr on Tuesday September 14, 2010 @06:00AM
(#1690050)
Dividing one 32-bit number by another is a constant-time operation even if on some machines (e.g. ARM) it is implemented as a loop. This is what matters. Raising a number to the nth power is an O(log n) operation.
[ Parent
| on HN ]
Division takes a data-dependent number of cycles on all x86-64 processors.
But the dividing instruction is still O(1).