Saltar al contenido
← volver

Steinar H. Gunderson: Decompilation patterns part 9, sign extension

Planet Debian · blog.sesse.net Publicado:

Today, for something completely different: s.x = (s16) ((s32) (temp_v0 > 0x11); MIPS has 16-bit loads and stores, but not 16-bit (signed) arithmetic, so if it wants to do that, it needs to sign-extend to 32-bit first. And it does that by first shifting up by 16 so that the 16-bit sign bit is at the 32-bit sign bit, and then it can do an arithmetic shift afterwards. So what you want is: s16 temp_v0; s.x = temp_v0 >> 1; Sometimes, it can be pretty stubborn, and you'll need to go through memory or…

Leer original →

Más de Planet Debian