mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-23 20:33:05 +00:00
undo util_endianswap
This commit is contained in:
parent
691d146d9b
commit
cda5076356
1 changed files with 6 additions and 4 deletions
10
util.c
10
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue