Linux

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

Today, for something completely different: s.x = (s16) ((s32) (temp_v0 << 0x10) >> 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…

Quelle: Originalartikel öffnen

AI Assistant
Context loaded: Steinar H. Gunderson: Decompilation patterns part 9, sign ex