Thank you Christoph. I replaced the code. As far as I can tell the trick should work. Unfortunately, VS optimizer figured out that the third case cannot happen and removed it - the second case was being executed instead. What a stupid compiler. I hope someone will write asm for this piece of code :) Regards, Radek