A very easy optimization is just to do a strength reduction on the
operations preceeding the loop.
Instead of the following two lines…
int n = (width+7)/8;
switch (width % 8) {
…you can just use…
int n = (width+7)>>3;
switch (width & 0x03) {
I just don’t like the way the loop is nested. (Looks horrible.)
Something like…
switch (blah) {
do {
case 0:
case 7:
...
} while (blah)
}
Seems to make a bit more sense. (However that might lead to one more jump
instruction, I’m not sure.) (It’s an asthetic thing, I know.)
Paul Braman
@Paul_Braman