ARM > Efficient C for ARM > Division and Modulus
Previous topic:
Floating Point
Next topic:
Unaligned Data Access
iOS Wedding Vector Trace Toy Toolbar Tip The Great Escape TargetedOptimisation Spectrum Slide Site Sinclair Simpsons Script Risc PC Reverse Engineering Retro Recreation RISC OS QuickFiler Python Project PrivateEye Pixel Art PhotoFiler Optimisation Ocean MotionMasks Logo Links LEGO Iyonix Isometric IntroductionToARM Hardware Hard Disc Groening GitHub Geminus Game Futurama Electron EfficientC Dump Doodle Disenchantment Disassembly Containers Chase H.Q. Blog Blender BasicOptimisation BBC Micro Article Archimedes Aha Acorn ARM 3D 2D
Like floating point, division is also emulated.
It’s implemented by two runtime library functions. In ARM’s tools they’re called:
__rt_sdiv for signed values.__rt_udiv for unsigned values.Slow:
It’s not always so bad for divisions by a constant:
Possible solutions:
Modulus is implemented by the same routine as division.