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