[Pkg-javascript-commits] [pdf.js] 27/161: More bit friendly decodeIAID and decodeInteger

David Prévot taffit at moszumanska.debian.org
Sat Apr 19 14:16:20 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 02a5f9435ac1fed58efad2a0feabd9ce1a44d3a2
Author: p01 <p01 at opera.com>
Date:   Tue Mar 4 17:28:53 2014 +0100

    More bit friendly decodeIAID and decodeInteger
---
 src/core/jbig2.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/core/jbig2.js b/src/core/jbig2.js
index 945c382..aad7d29 100755
--- a/src/core/jbig2.js
+++ b/src/core/jbig2.js
@@ -105,7 +105,7 @@ var Jbig2Image = (function Jbig2ImageClosure() {
           offset = 340;
           break;
         default:
-          v = v * 2 + bit;
+          v = ((v << 1) | bit) >>> 0;
           if (--toRead === 0) {
             state = 0;
           }
@@ -124,12 +124,12 @@ var Jbig2Image = (function Jbig2ImageClosure() {
     var prev = 1;
     for (var i = 0; i < codeLength; i++) {
       var bit = decoder.readBit(contexts, prev);
-      prev = (prev * 2) + bit;
+      prev = (prev << 1) | bit;
     }
     if (codeLength < 31) {
       return prev & ((1 << codeLength) - 1);
     }
-    return prev - Math.pow(2, codeLength);
+    return prev & 0x7FFFFFFF;
   }
 
   // 7.3 Segment types

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list