changeset 30541:e0996062f8e9

Simplify and slightly speed up avi_stream_id function.
author reimar
date Sun, 14 Feb 2010 15:09:21 +0000
parents bf9ec7f73c86
children 4995c42045c9
files libmpdemux/demuxer.h
diffstat 1 files changed, 2 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demuxer.h	Sun Feb 14 14:54:48 2010 +0000
+++ b/libmpdemux/demuxer.h	Sun Feb 14 15:09:21 2010 +0000
@@ -389,13 +389,9 @@
 stream_t* new_ds_stream(demux_stream_t *ds);
 
 static inline int avi_stream_id(unsigned int id){
-  unsigned char *p=(unsigned char *)&id;
   unsigned char a,b;
-#if HAVE_BIGENDIAN
-  a=p[3]-'0'; b=p[2]-'0';
-#else
-  a=p[0]-'0'; b=p[1]-'0';
-#endif
+  a = id - '0';
+  b = (id >> 8) - '0';
   if(a>9 || b>9) return 100; // invalid ID
   return a*10+b;
 }