Best to avoid division if at all possible on arm:

From

Writing efficient C for ARM
**Division and Remainder**
The ARM instruction set does not provide integer division. Divisions are typically

implemented by calling a C-library function (__rt_sdiv for signed and __rt_udiv for

unsigned division). Depending on the numerator and denominator, a 32-bit division takes

20-140 cycles. The division function takes a constant time plus a time for each bit to

divide:

Time(numerator / denominator)

= C0 + C1 * log2(numerator / denominator) =

= C0 + C1 * (log2(numerator) - log2(denominator)).

The current version takes about 20 + 4.3N cycles.

As division is an expensive operation, it is desirable to avoid it where possible. Sometimes

expressions can be rewritten so that a division becomes a multiplication. For example,

(x / y) > z can be rewritten as x > (z * y) if it is known that y is positive and y * z

fits in an integer.

It is best to use unsigned division by ensuring that one of the operands is unsigned, as this

is faster than signed division. This applies both to the division subroutines and to divisions

by a power of two (see 3.2 Division and remainder by powers of two).

In the following sections several methods are discussed to improve division efficiency.