Tixanou@lemmy.world to Programmer Humor@lemmy.ml · 10 months agocoding chesslemmy.worldimagemessage-square41fedilinkarrow-up16arrow-down10
arrow-up16arrow-down1imagecoding chesslemmy.worldTixanou@lemmy.world to Programmer Humor@lemmy.ml · 10 months agomessage-square41fedilink
minus-square Morphit @feddit.uklinkfedilinkarrow-up0·10 months 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.