It's much smaller than it looks - the switch will be optimized away by thecompiler. For the X86_CMPXCHG case it is even a single instruction.For the other case it should be < 10 instructions, which is still reasonable.