compat: backport sign_extend32()