Fix the windows build of lundump.c.

This commit is contained in:
John Bauer
2007-04-23 02:50:04 +00:00
parent 4f38eb717e
commit 2427d793dd
+17 -12
View File
@@ -78,17 +78,22 @@ static lua_Number LoadNumber(LoadState* S)
if (!S->flip) if (!S->flip)
return x; return x;
#ifdef LUA_NUMBER_DOUBLE #ifdef LUA_NUMBER_DOUBLE
union { double d; uint32_t i[2]; } u; {
u.d = x; union { double d; uint32_t i[2]; } u;
uint32_t temp = Swap32(u.i[0]); uint32_t temp;
u.i[0] = Swap32(u.i[1]); u.d = x;
u.i[1] = temp; temp = Swap32(u.i[0]);
return u.d; u.i[0] = Swap32(u.i[1]);
u.i[1] = temp;
return u.d;
}
#else #else
union { float f; uint32_t i } u; {
u.f = x; union { float f; uint32_t i } u;
u.i = Swap32(u.i); u.f = x;
return u.f; u.i = Swap32(u.i);
return u.f;
}
#endif #endif
} }
@@ -108,13 +113,13 @@ static TString* LoadString(LoadState* S)
static void LoadCode(LoadState* S, Proto* f) static void LoadCode(LoadState* S, Proto* f)
{ {
int n=LoadInt(S); int n=LoadInt(S);
int i=0;
f->code=luaM_newvector(S->L,n,Instruction); f->code=luaM_newvector(S->L,n,Instruction);
f->sizecode=n; f->sizecode=n;
LoadVector(S,f->code,n,sizeof(Instruction)); LoadVector(S,f->code,n,sizeof(Instruction));
if (!S->flip) if (!S->flip)
return; return;
int i; for (i=0; i<n; ++i)
for (i=0; i<n; i++)
f->code[i] = Swap32(f->code[i]); f->code[i] = Swap32(f->code[i]);
} }