6l: fix vlong byte order when running on big endian machine (thanks erik quanstro)

This commit is contained in:
cinap_lenrek 2015-08-16 13:41:14 +02:00
parent 0b48d5fdbf
commit cf74c80e7b
2 changed files with 18 additions and 2 deletions

View file

@ -354,6 +354,7 @@ vlong entryvalue(void);
void errorexit(void);
void export(void);
int find1(long, int);
int find1v(vlong, int);
int find2(long, int);
void follow(void);
void gethunk(void);

View file

@ -1417,12 +1417,14 @@ nuxiinit(void)
if(i < 1)
inuxi1[i] = c;
inuxi4[i] = c;
inuxi8[i] = c;
inuxi8[i+4] = c+4;
fnuxi4[i] = c;
fnuxi8[i] = c;
fnuxi8[i+4] = c+4;
}
for(i=0; i<8; i++)
inuxi8[i] = find1v(0x0807060504030201LL, i+1);
if(debug['v']) {
Bprint(&bso, "inuxi = ");
for(i=0; i<1; i++)
@ -1460,6 +1462,19 @@ find1(long l, int c)
return 0;
}
int
find1v(vlong l, int c)
{
char *p;
int i;
p = (char*)&l;
for(i=0; i<8; i++)
if(*p++ == c)
return i;
return 0;
}
int
find2(long l, int c)
{