Skip to content

Commit

Permalink
fix and optimize typed array loads in Frame
Browse files Browse the repository at this point in the history
  • Loading branch information
kripken committed Dec 18, 2014
1 parent 39a7b0a commit d78dde6
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,20 @@ module J2ME {
return this.read8() << 8 | this.read8();
}

read32(): number {
read32signed(): number {
return this.read16() << 16 | this.read16();
}

read8signed(): number {
var x = this.read8();
return (x > 0x7f) ? (x - 0x100) : x;
return this.read8() << 24 >> 24;
}

read16signed(): number {
var x = this.read16();
return (x > 0x7fff) ? (x - 0x10000) : x;
return this.read16() << 16 >> 16;
}

read32signed(): number {
var x = this.read32();
return (x > 0x7fffffff) ? (x - 0x100000000) : x;
read32(): number {
return this.read32() >>> 0;
}

/**
Expand Down Expand Up @@ -492,4 +489,4 @@ module J2ME {
}

var Context = J2ME.Context;
var Frame = J2ME.Frame;
var Frame = J2ME.Frame;

0 comments on commit d78dde6

Please sign in to comment.