Changeset 30094
- Timestamp:
- 02/15/09 21:45:40 (4 years ago)
- Location:
- lang/javascript/hsp-on-js/trunk/src
- Files:
-
- 2 modified
-
binary-parser.js (modified) (4 diffs)
-
formatter.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/hsp-on-js/trunk/src/binary-parser.js
r28714 r30094 23 23 p.prototype = { 24 24 readChar: function() { 25 this.checkBuffer(this.offset + 1); 26 var result = this.buffer[this.buffer.length - this.offset - 1]; 27 if(result & 0x80) result -= 0x100; 28 ++ this.offset; 29 return result; 25 return this.readUChar() << 24 >> 24; 30 26 }, 31 27 readUChar: function() { … … 36 32 }, 37 33 readShort: function() { 38 this.checkBuffer(this.offset + 2); 39 var result = this.buffer[this.buffer.length - this.offset - 1]; 40 result |= this.buffer[this.buffer.length - this.offset - 2] << 8; 41 if(result & 0x8000) result -= 0x10000; 42 this.offset += 2; 43 return result; 34 return this.readUShort() << 16 >> 16; 44 35 }, 45 36 readUShort: function() { … … 51 42 }, 52 43 readInt24: function() { 53 this.checkBuffer(this.offset + 3); 54 var result = this.buffer[this.buffer.length - this.offset - 1]; 55 result |= this.buffer[this.buffer.length - this.offset - 2] << 8; 56 result |= this.buffer[this.buffer.length - this.offset - 3] << 16; 57 if(result & 0x800000) result -= 0x1000000; 58 this.offset += 3; 59 return result; 44 return this.readUInt24() << 8 >> 8; 60 45 }, 61 46 readUInt24: function() { … … 77 62 }, 78 63 readUInt: function() { 79 this.checkBuffer(this.offset + 4); 80 var result = this.buffer[this.buffer.length - this.offset - 1]; 81 result |= this.buffer[this.buffer.length - this.offset - 2] << 8; 82 result |= this.buffer[this.buffer.length - this.offset - 3] << 16; 83 result += this.buffer[this.buffer.length - this.offset - 4] * 0x1000000; 84 this.offset += 4; 85 return result; 64 return this.readInt() >>> 0; 86 65 }, 87 66 readDouble: function() { -
lang/javascript/hsp-on-js/trunk/src/formatter.js
r30092 r30094 92 92 convertInt: function(val, flags, width, prec, signed, radix, pre) { 93 93 if(!signed) { 94 if(val & 0x80000000) val += 0x100000000;94 val >>>= 0; 95 95 } 96 96 var isNegative = val < 0;
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)