diff options
| author | Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> | 1996-11-07 11:59:51 -0200 |
|---|---|---|
| committer | Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> | 1996-11-07 11:59:51 -0200 |
| commit | 8d50122af03aec0c5271471f95798a5c98f30378 (patch) | |
| tree | e8b712130a21554189e910cdc142841960f4a4c3 | |
| parent | fd379b38f7e4be161f0e362745854a2f7f4b5d07 (diff) | |
| download | lua-8d50122af03aec0c5271471f95798a5c98f30378.tar.gz lua-8d50122af03aec0c5271471f95798a5c98f30378.tar.bz2 lua-8d50122af03aec0c5271471f95798a5c98f30378.zip | |
replaced unions by memcpy
| -rw-r--r-- | undump.c | 21 |
1 files changed, 9 insertions, 12 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.13 1996/03/12 20:00:40 lhf Exp lhf $"; | 6 | char* rcs_undump="$Id: undump.c,v 1.14 1996/03/14 17:31:15 lhf Exp $"; |
| 7 | 7 | ||
| 8 | #include <stdio.h> | 8 | #include <stdio.h> |
| 9 | #include <string.h> | 9 | #include <string.h> |
| @@ -142,13 +142,14 @@ static void Unthread(Byte* code, int i, int v) | |||
| 142 | { | 142 | { |
| 143 | while (i!=0) | 143 | while (i!=0) |
| 144 | { | 144 | { |
| 145 | CodeWord c; | 145 | Word w; |
| 146 | Byte* p=code+i; | 146 | Byte* p=code+i; |
| 147 | get_word(c,p); | 147 | Byte* c=&w; |
| 148 | i=c.w; | 148 | get_word(w,p); |
| 149 | c.w=v; | 149 | i=w; |
| 150 | p[-2]=c.m.c1; | 150 | w=v; |
| 151 | p[-1]=c.m.c2; | 151 | p[-2]=c[0]; |
| 152 | p[-1]=c[1]; | ||
| 152 | } | 153 | } |
| 153 | } | 154 | } |
| 154 | 155 | ||
| @@ -208,13 +209,9 @@ static void LoadFunction(FILE* D) | |||
| 208 | } | 209 | } |
| 209 | else /* fix PUSHFUNCTION */ | 210 | else /* fix PUSHFUNCTION */ |
| 210 | { | 211 | { |
| 211 | CodeCode c; | ||
| 212 | Byte* p; | ||
| 213 | tf->marked=LoadWord(D); | 212 | tf->marked=LoadWord(D); |
| 214 | tf->fileName=Main->fileName; | 213 | tf->fileName=Main->fileName; |
| 215 | p=Main->code+tf->marked; | 214 | memcpy(Main->code+tf->marked,&tf,sizeof(tf)); |
| 216 | c.tf=tf; | ||
| 217 | *p++=c.m.c1; *p++=c.m.c2; *p++=c.m.c3; *p++=c.m.c4; | ||
| 218 | lastF=lastF->next=tf; | 215 | lastF=lastF->next=tf; |
| 219 | } | 216 | } |
| 220 | tf->code=LoadBlock(tf->size,D); | 217 | tf->code=LoadBlock(tf->size,D); |
