aboutsummaryrefslogtreecommitdiffstats
path: root/util/scan/section.c
diff options
context:
space:
mode:
authorDebian VDR Team <pkg-vdr-dvb-devel@lists.alioth.debian.org>2006-06-03 13:12:54 +0200
committeretobi <git@e-tobi.net>2013-09-03 09:48:40 +0200
commit43dd9e25dce3963f25444533466ad1f8faa66e47 (patch)
tree134e7e7d2a0f0df1e731e65bffc445bd026539fb /util/scan/section.c
parent2ade78e0b7545aa63792aa4b08f0f88eba0b0e3e (diff)
parent6b350466c4902c5b137e0efaf1d189128a7f18f5 (diff)
downloadlinux-dvb-apps-43dd9e25dce3963f25444533466ad1f8faa66e47.tar.gz
Imported Debian patch 1.1.1-1debian/1.1.1-1
Diffstat (limited to 'util/scan/section.c')
-rw-r--r--util/scan/section.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/util/scan/section.c b/util/scan/section.c
new file mode 100644
index 0000000..8e49947
--- /dev/null
+++ b/util/scan/section.c
@@ -0,0 +1,25 @@
+#include "section.h"
+
+/* shamelessly stolen from dvbsnoop, but modified */
+u32 getBits (const u8 *buf, int startbit, int bitlen)
+{
+ const u8 *b;
+ u32 mask,tmp_long;
+ int bitHigh,i;
+
+ b = &buf[startbit / 8];
+ startbit %= 8;
+
+ bitHigh = 8;
+ tmp_long = b[0];
+ for (i = 0; i < ((bitlen-1) >> 3); i++) {
+ tmp_long <<= 8;
+ tmp_long |= b[i+1];
+ bitHigh += 8;
+ }
+
+ startbit = bitHigh - startbit - bitlen;
+ tmp_long = tmp_long >> startbit;
+ mask = (1ULL << bitlen) - 1;
+ return tmp_long & mask;
+}