AND faster than integer modulo operation?

后端 未结 6 1811
自闭症患者
自闭症患者 2021-02-14 09:34

It is possible to re-express:

  • i % m

as:

  • i & (m-1)

where,

  • i is an unsigned integer
  • m is a po
6条回答
  •  北恋
    北恋 (楼主)
    2021-02-14 10:18

    According to http://www.coranac.com/tonc/text/asm.htm, the ARM has no division instruction. If that's true, then I wouldn't expect it to have a MOD instruction, either.

提交回复
热议问题