Modulo bug (ColdFire, CW 7.2)

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Modulo bug (ColdFire, CW 7.2)

1,591 次查看
MrBean
Contributor I

note: uint16 sum = 90;

 

 

 if( ( sum%15 ) != 0 ) 00010DE6: 7400            moveq    #0,d200010DE8: 3401            move.w   d1,d200010DEA: 700F            moveq    #15,d000010DEC: 84C0            divu.w   d0,d200010DEE: 4842            swap     d200010DF0: 6704            beq.s    ThisFunction+0xc8 (0x10df6); 0x00010df6

 

 

The result in d2 before the swap is 0x00000006.

After the swap it is 0x00060000.

Not  zero... 

Hence 90%15 is not zero, according to this compiler.

 

Be warned!

(Service request submitted)

标签 (1)
标记 (1)
0 项奖励
回复
1 回复

1,092 次查看
MrBean
Contributor I

Apparently caused by unchecking "4-byte integers" in the compiler options.

Solved in V10 by not having this option ....

0 项奖励
回复