Mercurial > libdvdnav.hg
comparison decoder.c @ 166:3bfaec0c1288 src
* fix warnings with gcc 3.3
* some menu sanity checking in highlight.c (the button functions should do nothing,
when called outside a menu)
* escape should take us to the Root menu, not the Title menu, since this is what
the standard "Menu" button on a DVD player does
| author | mroi |
|---|---|
| date | Mon, 21 Apr 2003 13:18:06 +0000 |
| parents | a68751e6e84f |
| children | 90b1f6f0520e |
comparison
equal
deleted
inserted
replaced
| 165:4e5ebc1491d5 | 166:3bfaec0c1288 |
|---|---|
| 34 #include <assert.h> | 34 #include <assert.h> |
| 35 #include "dvdnav_internal.h" | 35 #include "dvdnav_internal.h" |
| 36 | 36 |
| 37 uint32_t vm_getbits(command_t *command, int start, int count) { | 37 uint32_t vm_getbits(command_t *command, int start, int count) { |
| 38 uint64_t result = 0; | 38 uint64_t result = 0; |
| 39 uint64_t bit_mask=0xffffffffffffffff; /* I could put -1 instead */ | 39 uint64_t bit_mask = 0; |
| 40 uint64_t examining = 0; | 40 uint64_t examining = 0; |
| 41 int32_t bits; | 41 int32_t bits; |
| 42 | 42 |
| 43 if (count == 0) return 0; | 43 if (count == 0) return 0; |
| 44 | 44 |
| 45 if ( ((start - count) < -1) || | 45 if ( ((start - count) < -1) || |
| 46 (count > 32) || | 46 (count > 32) || |
| 47 (start > 63) || | 47 (start > 63) || |
| 48 (count < 0) || | 48 (count < 0) || |
| 49 (start < 0) ) { | 49 (start < 0) ) { |
| 50 fprintf(MSG_OUT, "libdvdnav: Bad call to vm_getbits. Parameter out of range\n"); | 50 fprintf(MSG_OUT, "libdvdnav: Bad call to vm_getbits. Parameter out of range\n"); |
| 51 assert(0); | 51 assert(0); |
| 52 } | 52 } |
| 53 /* all ones, please */ | |
| 54 bit_mask = ~bit_mask; | |
| 53 bit_mask >>= 63 - start; | 55 bit_mask >>= 63 - start; |
| 54 bits = start + 1 - count; | 56 bits = start + 1 - count; |
| 55 examining = ((bit_mask >> bits) << bits ); | 57 examining = ((bit_mask >> bits) << bits ); |
| 56 command->examined |= examining; | 58 command->examined |= examining; |
| 57 result = (command->instruction & bit_mask) >> bits; | 59 result = (command->instruction & bit_mask) >> bits; |
