undo util_endianswap

This commit is contained in:
Dale Weiler 2012-04-22 16:59:00 -04:00
parent 691d146d9b
commit cda5076356

10
util.c
View file

@ -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;
}
}
}