> i've definitely written a lot of assembly code by hand where i did far, far more perverted things to save a single byte
I mean, obviously, me too. But this is a general purpose compiler: emitting a runtime division by a compile time constant power-of-two is just silly. If you actually care about saving one byte of text and you're writing C, you're doing it wrong. As you point out, it's pretty trivial to beat the compiler most of the time.
I mean, obviously, me too. But this is a general purpose compiler: emitting a runtime division by a compile time constant power-of-two is just silly. If you actually care about saving one byte of text and you're writing C, you're doing it wrong. As you point out, it's pretty trivial to beat the compiler most of the time.
See below, clang does what I want here.