Merge pull request #222 from GMScribe/master

Fixed global swap2() providing incorrect results
This commit is contained in:
Alberto Demichelis
2020-07-17 16:52:22 +08:00
committed by GitHub

View File

@ -205,8 +205,8 @@ static SQInteger _g_blob_swap2(HSQUIRRELVM v)
{
SQInteger i;
sq_getinteger(v,2,&i);
short s=(short)i;
sq_pushinteger(v,(s<<8)|((s>>8)&0x00FF));
unsigned short s = (unsigned short)i;
sq_pushinteger(v, ((s << 8) | ((s >> 8) & 0x00FFu)) & 0xFFFFu);
return 1;
}