mirror of
https://github.com/ioquake/jedi-academy.git
synced 2024-11-25 13:41:34 +00:00
provide a gcc style alternative to the inline asm in zlib
This commit is contained in:
parent
dca7904229
commit
0e3191e122
2 changed files with 15 additions and 1 deletions
|
@ -1210,6 +1210,7 @@ static void lm_init(deflate_state *s)
|
||||||
inline byte *qcmp(byte *scan, byte *match, ulong count)
|
inline byte *qcmp(byte *scan, byte *match, ulong count)
|
||||||
{
|
{
|
||||||
byte *retval;
|
byte *retval;
|
||||||
|
#ifdef _MSC_VER
|
||||||
_asm
|
_asm
|
||||||
{
|
{
|
||||||
push esi
|
push esi
|
||||||
|
@ -1226,6 +1227,12 @@ inline byte *qcmp(byte *scan, byte *match, ulong count)
|
||||||
mov [retval], esi
|
mov [retval], esi
|
||||||
pop esi
|
pop esi
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
asm("repe cmpsb;"
|
||||||
|
: "=S"(retval)
|
||||||
|
: "S"(scan), "D"(match), "c"(count)
|
||||||
|
);
|
||||||
|
#endif
|
||||||
return(--retval);
|
return(--retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2075,4 +2082,4 @@ bool DeflateFile(byte *src, ulong uncompressedSize, byte *dst, ulong maxCompress
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// end
|
// end
|
||||||
|
|
|
@ -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)
|
inline byte *qcopy(byte *dst, byte *src, int count)
|
||||||
{
|
{
|
||||||
byte *retval;
|
byte *retval;
|
||||||
|
#ifdef _MSC_VER
|
||||||
_asm
|
_asm
|
||||||
{
|
{
|
||||||
push ecx
|
push ecx
|
||||||
|
@ -515,6 +516,12 @@ inline byte *qcopy(byte *dst, byte *src, int count)
|
||||||
pop esi
|
pop esi
|
||||||
pop ecx
|
pop ecx
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
asm("repe movsb;"
|
||||||
|
: "=D"(retval)
|
||||||
|
: "D"(dst), "S"(src), "c"(count)
|
||||||
|
);
|
||||||
|
#endif
|
||||||
return(retval);
|
return(retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue