Mercurial > mplayer.hg
comparison libmpdemux/demux_mov.c @ 7654:a2e735271814
BE_16/BE_32 macro was accessing integers from unaligned addresses on SPARC
char2short/char2int broken on BIGENDIAN
author | jkeil |
---|---|
date | Mon, 07 Oct 2002 16:43:04 +0000 |
parents | d71300143887 |
children | 0568245deeb8 |
comparison
equal
deleted
inserted
replaced
7653:fd7e83ee2f71 | 7654:a2e735271814 |
---|---|
45 // inclusion of fcntl.h cause cygwin gcc crash | 45 // inclusion of fcntl.h cause cygwin gcc crash |
46 #ifndef __CYGWIN__ | 46 #ifndef __CYGWIN__ |
47 #include <fcntl.h> | 47 #include <fcntl.h> |
48 #endif | 48 #endif |
49 | 49 |
50 #define BE_16(x) (be2me_16(*(unsigned short *)(x))) | 50 #define BE_16(x) (((unsigned char *)(x))[0] << 8 | \ |
51 #define BE_32(x) (be2me_32(*(unsigned int *)(x))) | 51 ((unsigned char *)(x))[1]) |
52 | 52 #define BE_32(x) (((unsigned char *)(x))[0] << 24 | \ |
53 #ifndef WORDS_BIGENDIAN | 53 ((unsigned char *)(x))[1] << 16 | \ |
54 #define char2short(x,y) ((x[y]<<8)|x[y+1]) | 54 ((unsigned char *)(x))[2] << 8 | \ |
55 #define char2int(x,y) ((x[y]<<24)|(x[y+1]<<16)|(x[y+2]<<8)|x[y+3]) | 55 ((unsigned char *)(x))[3]) |
56 #else | 56 |
57 #warning Check the implementation of char2short and char2int on BIGENDIAN!!! | 57 #define char2short(x,y) BE_16(&(x)[(y)]) |
58 #define char2short(x,y) (x[y]|(x[y+1]<<8)) | 58 #define char2int(x,y) BE_32(&(x)[(y)]) |
59 #define char2int(x,y) (x[y]|(x[y+1]<<8)|(x[y+2]<<16)|(x[y+3]<<24)) | |
60 #endif | |
61 | 59 |
62 typedef struct { | 60 typedef struct { |
63 unsigned int pts; // duration | 61 unsigned int pts; // duration |
64 unsigned int size; | 62 unsigned int size; |
65 off_t pos; | 63 off_t pos; |