From: Dale Weiler Date: Sun, 22 Apr 2012 20:59:00 +0000 (-0400) Subject: undo util_endianswap X-Git-Tag: 0.1-rc1~641 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=cda507635685e2d5aa62a45d62fd4dc4c7515179;p=xonotic%2Fgmqcc.git undo util_endianswap --- diff --git a/util.c b/util.c index 62f6e14..136b12a 100644 --- a/util.c +++ b/util.c @@ -156,13 +156,15 @@ void util_endianswap(void *m, int s, int l) { size_t i = 0; /* ignore if we're already LE */ - // if(*((char *)&s)) - // return; + if(*((char *)&s)) + return; for(; w < l; w++) { for(; i < s << 1; i++) { - unsigned char *p = &((unsigned char *)m+w*s)[i]; - *p = ((*p * 0x0802LU & 0x22110LU) | (*p * 0x8020LU & 0x88440LU)) * 0x10101LU >> 16; + unsigned char *p = (unsigned char *)m+w*s; + unsigned char t = p[i]; + p[i] = p[s-i-1]; + p[s-i-1] = t; } } }