Index: mojo/apps/js/bindings/codec.js |
diff --git a/mojo/apps/js/bindings/codec.js b/mojo/apps/js/bindings/codec.js |
index 0245de4d3c843c2bf3d7b0062a713304aae690b0..bc5df809f0309ba7ed66df23e7ecb150e71e8472 100644 |
--- a/mojo/apps/js/bindings/codec.js |
+++ b/mojo/apps/js/bindings/codec.js |
@@ -45,9 +45,9 @@ define(function() { |
} |
function load64(memory, pointer) { |
- var low = load32(memory, pointer); |
- var high = load32(memory, pointer + 4); |
- return low + high * 0x10000; |
+ var low = Math.abs(load32(memory, pointer)); |
+ var high = Math.abs(load32(memory, pointer + 4)); |
+ return low + high * 0x100000000; |
} |
var kAlignment = 8; |
@@ -98,6 +98,9 @@ define(function() { |
this.handles = handles; |
this.base = base; |
this.next = base; |
+ this.viewU32 = new Uint32Array( |
+ this.memory.buffer, 0, |
+ Math.floor(this.memory.length / Uint32Array.BYTES_PER_ELEMENT)); |
} |
Decoder.prototype.skip = function(offset) { |
@@ -111,12 +114,16 @@ define(function() { |
}; |
Decoder.prototype.read32 = function() { |
- var result = load32(this.memory, this.next); |
- this.next += 4; |
+ var result = this.viewU32[this.next / this.viewU32.BYTES_PER_ELEMENT]; |
+ this.next += this.viewU32.BYTES_PER_ELEMENT; |
return result; |
}; |
Decoder.prototype.read64 = function() { |
+ var low = this.read32(); |
+ var high = this.read32(); |
+ return low + high * 0x100000000; |
+ |
var result = load64(this.memory, this.next); |
this.next += 8; |
return result; |
abarth-chromium
2013/12/20 04:21:02
These last few lines are dead now. You can probab
Aaron Boodman
2013/12/20 05:42:24
Eep. Thanks.
|