Try using a switch statement. It should produce code very similar to what you have posted, usually using a jump table but check the asm output to make sure it's acceptable.
Also, you might want to consider examining your algorythmic boundaries! (j/k)