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.
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
replies: