provide a gcc style alternative to the inline asm in zlib

This commit is contained in:
Jonathan Gray 2013-04-23 23:39:05 +10:00
parent dca7904229
commit 0e3191e122
2 changed files with 15 additions and 1 deletions

View file

@ -1210,6 +1210,7 @@ static void lm_init(deflate_state *s)
inline byte *qcmp(byte *scan, byte *match, ulong count)
{
byte *retval;
#ifdef _MSC_VER
_asm
{
push esi
@ -1226,6 +1227,12 @@ inline byte *qcmp(byte *scan, byte *match, ulong count)
mov [retval], esi
pop esi
}
#else
asm("repe cmpsb;"
: "=S"(retval)
: "S"(scan), "D"(match), "c"(count)
);
#endif
return(--retval);
}
@ -2075,4 +2082,4 @@ bool DeflateFile(byte *src, ulong uncompressedSize, byte *dst, ulong maxCompress
return(true);
}
// end
// end

View file

@ -499,6 +499,7 @@ static ulong needout(z_stream *z, inflate_blocks_state_t *s, ulong bytesToEnd)
inline byte *qcopy(byte *dst, byte *src, int count)
{
byte *retval;
#ifdef _MSC_VER
_asm
{
push ecx
@ -515,6 +516,12 @@ inline byte *qcopy(byte *dst, byte *src, int count)
pop esi
pop ecx
}
#else
asm("repe movsb;"
: "=D"(retval)
: "D"(dst), "S"(src), "c"(count)
);
#endif
return(retval);
}