AND faster than integer modulo operation?

后端 未结 6 1209
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-14 09:19

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:08

    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.

提交回复
热议问题