Why unsigned types are more efficient in arm cpu?

前端 未结 3 1040
醉酒成梦
醉酒成梦 2020-12-01 17:10

I\'m reading an arm manual and come to this suggestion, but the reason is not mentioned.

Why unsigned types are faster?

3条回答
  •  感情败类
    2020-12-01 17:37

    I think it's just that the instruction set for ARM CPUs is optimized for unsigned. Some operations can be done with one instruction for unsigned types but will need multiple instructions if it's signed. That's why I think if compiling for ARM in most (all?) C and C++ compilers it defaults to unsigned char rather than the more usual signed char.

提交回复
热议问题