mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-27 14:12:36 +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;
|
size_t i = 0;
|
||||||
|
|
||||||
/* ignore if we're already LE */
|
/* ignore if we're already LE */
|
||||||
// if(*((char *)&s))
|
if(*((char *)&s))
|
||||||
// return;
|
return;
|
||||||
|
|
||||||
for(; w < l; w++) {
|
for(; w < l; w++) {
|
||||||
for(; i < s << 1; i++) {
|
for(; i < s << 1; i++) {
|
||||||
unsigned char *p = &((unsigned char *)m+w*s)[i];
|
unsigned char *p = (unsigned char *)m+w*s;
|
||||||
*p = ((*p * 0x0802LU & 0x22110LU) | (*p * 0x8020LU & 0x88440LU)) * 0x10101LU >> 16;
|
unsigned char t = p[i];
|
||||||
|
p[i] = p[s-i-1];
|
||||||
|
p[s-i-1] = t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue