Tixanou@lemmy.world to Programmer Humor@lemmy.ml · 2 years agocoding chesslemmy.worldimagemessage-square41fedilinkarrow-up16arrow-down10
arrow-up16arrow-down1imagecoding chesslemmy.worldTixanou@lemmy.world to Programmer Humor@lemmy.ml · 2 years agomessage-square41fedilink
minus-square Morphit @feddit.uklinkfedilinkarrow-up0·2 years agoGodbolt to the rescue! So gcc 13.2 certainly does produce the same code, though a lot of other versions and compilers do it slightly differently. Surprisingly, clang doesn’t optimise this and uses idiv for the modulo version.
Godbolt to the rescue! So gcc 13.2 certainly does produce the same code, though a lot of other versions and compilers do it slightly differently. Surprisingly, clang doesn’t optimise this and uses
idiv
for the modulo version.