changeset 154:3492d41dc247 src

vm_getbits should be in decoder.c, because 1) it is declared in decoder.h 2) this is needed to compile correctly without tracing enabled
author mroi
date Sat, 05 Apr 2003 14:28:07 +0000
parents 175d5fef21e4
children 840e99bfb57d
files decoder.c vmcmd.c
diffstat 2 files changed, 24 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/decoder.c	Sat Apr 05 13:11:13 2003 +0000
+++ b/decoder.c	Sat Apr 05 14:28:07 2003 +0000
@@ -34,6 +34,30 @@
 #include <assert.h>
 #include "dvdnav_internal.h"
 
+uint32_t vm_getbits(command_t *command, int start, int count) {
+  uint64_t result = 0;
+  uint64_t bit_mask=0xffffffffffffffff;  /* I could put -1 instead */
+  uint64_t examining = 0;
+  int32_t  bits;
+
+  if (count == 0) return 0;
+
+  if ( ((start - count) < -1) ||
+       (count > 32) ||
+       (start > 63) ||
+       (count < 0) ||
+       (start < 0) ) {
+    fprintf(MSG_OUT, "libdvdnav: Bad call to vm_getbits. Parameter out of range\n");
+    assert(0);
+  }
+  bit_mask >>= 63 - start;
+  bits = start + 1 - count;
+  examining = ((bit_mask >> bits) << bits );
+  command->examined |= examining;
+  result = (command->instruction & bit_mask) >> bits;
+  return (uint32_t) result;
+}
+
 static uint16_t get_GPRM(registers_t* registers, uint8_t reg) {
   if (registers->GPRM_mode[reg] & 0x01) {
     struct timeval current_time, time_offset;
--- a/vmcmd.c	Sat Apr 05 13:11:13 2003 +0000
+++ b/vmcmd.c	Sat Apr 05 14:28:07 2003 +0000
@@ -115,29 +115,6 @@
   NULL,
 };
 
-uint32_t vm_getbits(command_t *command, int start, int count) {
-  uint64_t result = 0;
-  uint64_t bit_mask=0xffffffffffffffff;  /* I could put -1 instead */
-  uint64_t examining = 0;
-  int32_t  bits;
-  if (count == 0) return 0;
-
-  if ( ((start - count) < -1) ||
-       (count > 32) ||
-       (start > 63) ||
-       (count < 0) ||
-       (start < 0) ){
-    fprintf(stderr, "Bad call to vm_getbits. Parameter out of range\n");
-    assert(0);
-  }
-  bit_mask >>= 63 - start;
-  bits = start + 1 - count;
-  examining = ((bit_mask >> bits) << bits );
-  command->examined |= examining;
-  result = (command->instruction & bit_mask) >> bits;
-  return (uint32_t) result;
-}
-    
 static void print_system_reg(uint16_t reg) {
   if(reg < sizeof(system_reg_abbr_table) / sizeof(char *))
     fprintf(MSG_OUT, "%s (SRPM:%d)", system_reg_table[reg], reg);