]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Fix bug in signed Exp-Golomb mapping code. Fixes ticket #313
authorAndreas Öman <andreas@lonelycoder.com>
Mon, 25 Oct 2010 19:44:06 +0000 (19:44 +0000)
committerAndreas Öman <andreas@lonelycoder.com>
Mon, 25 Oct 2010 19:44:06 +0000 (19:44 +0000)
src/bitstream.c

index b88081990ce3af9f03e92dd0e0339dda009ac6e5..2d426758aa8b8b7060fa0c10f37c25152e11f077 100644 (file)
@@ -86,14 +86,14 @@ read_golomb_ue(bitstream_t *bs)
 signed int
 read_golomb_se(bitstream_t *bs)
 {
-  int v, neg;
+  int v, pos;
   v = read_golomb_ue(bs);
   if(v == 0)
     return 0;
 
-  neg = v & 1;
+  pos = v & 1;
   v = (v + 1) >> 1;
-  return neg ? -v : v;
+  return pos ? v : -v;
 }