Saltar al contenido
← volver

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

Planet Debian · blog.sesse.net Publicado:

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 a look at what's inside the loop as well.

Leer original →

Más de Planet Debian