Division is quite expensive.
Division can be done with subtraction, or shifting - right shift 10 (= /1024) and then compensate for that 24....
You may need too benchmark to see if on your chip this will yield any gaiin.
I did some quick benchmarking against the brutal force approach by Majenko (division followed by the mod operation), for full range 16-bit types, dividing by 1000, on a PIC16, XC8 free mode:
for 16-bit types
1. Majenko's approach (1000 divisor + mod): 45.9M ticks;
2. revised Majenko's approach (1000 divisor, no mod): 36.9M ticks;
3. My approach (1024 divisor, no mod): 20.8M ticks.
[edit 2]for 32-bit types
1. Majenko's approach (1000 divisor + mod): 101.6M ticks;
2. revised Majenko's approach (1000 divisor, no mod): 63.0M ticks;
3. My approach (1024 divisor, no mod): 19.3M ticks.
the same trend applies under the pro mode.
the same trend applies for AVR, with the speed gain being bigger.
edit 2: 32-bit benchmarking added.
I also revised my approach for 32-bit types to speed up the execution a little.
1) mod ops shall be avoided as much as you can;
2) divisions shall be avoided as much as you can.
3) algorithm rules!
however, be cautious to extrapolate the data here. on a chip with hardware multiplier + divider (STM8, my favorite chip), this trend may not apply and you should benchmark on the target chip to be safe.