Linux

Steinar H. Gunderson: Decompilation patterns, part 13: Reverse loop

Anyone who's read “bro-coder” C from before that was a name will recognize this idiom: var_t1_2 = 0x7F; … do { … var_t1_2 -= 1; } while (var_t1_2 >= 0); Why does the loop count backwards? It's because comparison with zero is cheaper on some (many) platforms. Some people would reverse the loop manually, but compilers quickly managed to do that themselves. So you want: for (i = 0; i < 0x80; ++i) { … } and tomorrow, we'll have…

Quelle: Originalartikel öffnen

AI Assistant
Context loaded: Steinar H. Gunderson: Decompilation patterns, part 13: Rever