diff options
author | Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> | 1996-03-14 14:31:15 -0300 |
---|---|---|
committer | Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> | 1996-03-14 14:31:15 -0300 |
commit | 58fd8aa851eac8736815663c3116e2e45b533bad (patch) | |
tree | 07603f58190a874ce54631b827e62f9eae811e4a | |
parent | 3226ac2da8477456aaa38443507d3f276ebd74b7 (diff) | |
download | lua-58fd8aa851eac8736815663c3116e2e45b533bad.tar.gz lua-58fd8aa851eac8736815663c3116e2e45b533bad.tar.bz2 lua-58fd8aa851eac8736815663c3116e2e45b533bad.zip |
added cast instead of union [lazy?]
-rw-r--r-- | undump.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -3,7 +3,7 @@ | |||
3 | ** load bytecodes from files | 3 | ** load bytecodes from files |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char* rcs_undump="$Id: undump.c,v 1.12 1996/03/11 22:01:46 lhf Exp lhf $"; | 6 | char* rcs_undump="$Id: undump.c,v 1.13 1996/03/12 20:00:40 lhf Exp lhf $"; |
7 | 7 | ||
8 | #include <stdio.h> | 8 | #include <stdio.h> |
9 | #include <string.h> | 9 | #include <string.h> |
@@ -158,7 +158,7 @@ static int LoadWord(FILE* D) | |||
158 | fread(&w,sizeof(w),1,D); | 158 | fread(&w,sizeof(w),1,D); |
159 | if (swapword) | 159 | if (swapword) |
160 | { | 160 | { |
161 | Byte* p=&w; /* TODO: need union? */ | 161 | Byte* p=(Byte*)&w; /* TODO: need union? */ |
162 | Byte t; | 162 | Byte t; |
163 | t=p[0]; p[0]=p[1]; p[1]=t; | 163 | t=p[0]; p[0]=p[1]; p[1]=t; |
164 | } | 164 | } |
@@ -267,7 +267,7 @@ static void LoadHeader(FILE* D) /* TODO: error handling */ | |||
267 | fread(&f,sizeof(f),1,D); /* test float */ | 267 | fread(&f,sizeof(f),1,D); /* test float */ |
268 | if (f!=tf) | 268 | if (f!=tf) |
269 | { | 269 | { |
270 | Byte* p=&f; /* TODO: need union? */ | 270 | Byte* p=(Byte*)&f; /* TODO: need union? */ |
271 | Byte t; | 271 | Byte t; |
272 | swapfloat=1; | 272 | swapfloat=1; |
273 | t=p[0]; p[0]=p[3]; p[3]=t; | 273 | t=p[0]; p[0]=p[3]; p[3]=t; |