True. The TEST instruction ANDs the two operands and sets the flags accordingly. If the two operands are the same thing, the result will be zero only if the operand(s) are zero. It is really a dumb thing to do, in this case. Comparing CL to zero and jumping accordingly would be much clearer. But coders often do dumb things. That's why they wear dirty teeshirts and smell bad.

True. The TEST instruction ANDs the two operands and sets the flags accordingly. If the two operands are the same thing, the result will be zero only if the operand(s) are zero. It is really a dumb thing to do, in this case. Comparing CL to zero and jumping accordingly would be much clearer. But coders often do dumb things. That's why they wear dirty teeshirts and smell bad.

It might be like how, in the bad old days (which I'm sure you remember ), some assembly coders used XOR (E)AX, (E)AX rather than MOV (E)AX, 0 because it was one byte shorter. I don't have my asm resources handy, but I'd expect TEST reg, reg is a few bytes shorter than TEST reg, imm32, unless it stores the immediate value as an 8-bit quantity, and sign-extends it.

I agree though, the clarity leaves something to be desired. However, if this was compiler-generated assembly (as seems likely from the context), the programmer has no business expecting it to be clear if optimizations are enabled.

__________________
My microwave has settings for snake, gremlin, and puppy.

Arguing about the readability of things such as 'XOR REG,REG'/'TEST REG,REG' is stupid. Someone should not be complaining about how they can understand somebody elses source when it's such a simple matter.

Furthermore, such instructions are not only shorter, they are a few clocks faster.

Dredging up a six month old thread to call people stupid, and having your first two posts in a forum call people stupid, is a sure way to make a name for yourself. Unfortunately, that name isn't a very nice one.

Dredging up a six month old thread to call people stupid, and having your first two posts in a forum call people stupid, is a sure way to make a name for yourself. Unfortunately, that name isn't a very nice one.

Fortunately for me, the first page goes back further than 6 months Albeit the fact that the main benefactors of the thread probably won't see it, others who are looking into the subject probably will. So I'm not too concerned about making a name for myself, good or bad.

For you to even bring up the argument of repertoire in a forum which is essentially made for helping others is laughable, so please; consider this my first and only response to you.

I wasn't having a go at you because you haven't posted much, if that is what you mean by "argument of repertoire". Extra helpers here are always welcome. Calling people who are asking questions and people who are answering them "stupid" is not helping, in fact it is a great hindrance to a forum such as this as it is likely to turn people away.