forked from len0rd/rockbox
quake: fix unaligned accesses in model.c
Allows playing registered episodes. Change-Id: I20e1ca2000776a19767a9c3caef790d4f62ca188
This commit is contained in:
parent
2ca47176f9
commit
ef9ee8935f
3 changed files with 198 additions and 119 deletions
|
@ -88,12 +88,29 @@ void InsertLinkAfter (link_t *l, link_t *after);
|
|||
|
||||
extern qboolean bigendien;
|
||||
|
||||
extern short (*BigShort) (short l);
|
||||
extern short (*LittleShort) (short l);
|
||||
extern int (*BigLong) (int l);
|
||||
extern int (*LittleLong) (int l);
|
||||
extern float (*BigFloat) (float l);
|
||||
extern float (*LittleFloat) (float l);
|
||||
// not safe on unaligned data
|
||||
extern short (*BigShort) (short l);
|
||||
extern short (*LittleShort) (short l);
|
||||
extern int (*BigLong) (int l);
|
||||
extern int (*LittleLong) (int l);
|
||||
extern float (*BigFloat) (float l);
|
||||
extern float (*LittleFloat) (float l);
|
||||
|
||||
#define LittleShortUnaligned(x) ReadLittleShort(((char*)(&(x))))
|
||||
#define BigShortUnaligned(x) ReadBigShort(((char*)&(x)))
|
||||
#define LittleLongUnaligned(x) ReadLittleLong(((char*)&(x)))
|
||||
#define BigLongUnaligned(x) ReadBigLong(((char*)&(x)))
|
||||
#define LittleFloatUnaligned(x) ReadLittleFloat(((char*)&(x)))
|
||||
#define BigFloatUnaligned(x) ReadBigFloat(((char*)&(x))
|
||||
|
||||
|
||||
// for unaligned
|
||||
short ReadBigShort (char *l);
|
||||
short ReadLittleShort (char *l);
|
||||
int ReadBigLong (char *l);
|
||||
int ReadLittleLong (char *l);
|
||||
float ReadBigFloat (char *l);
|
||||
float ReadLittleFloat (char *l);
|
||||
|
||||
//============================================================================
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue