Skip to content

Commit

Permalink
feat(decoder): implement diagnose decoder
Browse files Browse the repository at this point in the history
Fixes #5
  • Loading branch information
dignifiedquire committed Dec 9, 2016
1 parent 614b6ab commit 857f9a9
Show file tree
Hide file tree
Showing 12 changed files with 433 additions and 417 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
src/decoder.asm.js
src/commented.js
src/diagnose.js
test/*.ava.js
2 changes: 2 additions & 0 deletions benchmarks/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict'

console.log('PID: %s', process.pid)

const Benchmark = require('benchmark')
if (typeof window !== 'undefined') {
window.Benchmark = Benchmark
Expand Down
16 changes: 16 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict'

const Bignumber = require('bignumber.js')

exports.MT = {
POS_INT: 0,
NEG_INT: 1,
Expand Down Expand Up @@ -55,3 +57,17 @@ exports.SYMS = {

exports.SHIFT32 = Math.pow(2, 32)
exports.SHIFT16 = Math.pow(2, 16)

exports.MAX_SAFE_HIGH = 0x1fffff
exports.NEG_ONE = new Bignumber(-1)
exports.TEN = new Bignumber(10)
exports.TWO = new Bignumber(2)

exports.PARENT = {
ARRAY: 0,
OBJECT: 1,
MAP: 2,
TAG: 3,
BYTE_STRING: 4,
UTF8_STRING: 5
}
2 changes: 1 addition & 1 deletion src/decoder.asm.js
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ module.exports = function decodeAsm (stdlib, foreign, buffer) {
function TAG_UNASSIGNED (octet) {
octet = octet | 0

pushTagUnassigned(octet | 0)
pushTagStart((octet - 192| 0) | 0)

offset = (offset + 1 | 0)

Expand Down

0 comments on commit 857f9a9

Please sign in to comment.