From f9eca70374758be04231c2e99c2a85de9f931e3f Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Tue, 15 Aug 2017 18:47:34 -0700 Subject: [PATCH] pkg: upgrade n64. --- lib/utils/gcs.js | 22 +++++++++++----------- package.json | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/utils/gcs.js b/lib/utils/gcs.js index c4cde9e8..a0881190 100644 --- a/lib/utils/gcs.js +++ b/lib/utils/gcs.js @@ -7,11 +7,11 @@ 'use strict'; const assert = require('assert'); -const Int64 = require('./int64'); +const {U64} = require('./int64'); const digest = require('../crypto/digest'); const siphash = require('../crypto/siphash'); const DUMMY = Buffer.alloc(0); -const EOF = new Int64(-1); +const EOF = new U64(-1); /** * GCSFilter @@ -22,7 +22,7 @@ const EOF = new Int64(-1); function GCSFilter() { this.n = 0; this.p = 0; - this.m = new Int64(0); + this.m = new U64(0); this.data = DUMMY; } @@ -38,7 +38,7 @@ GCSFilter.prototype.header = function header(prev) { GCSFilter.prototype.match = function match(key, data) { const br = new BitReader(this.data); const term = siphash24(data, key).imod(this.m); - let last = new Int64(0); + let last = new U64(0); while (last.lt(term)) { const value = this.readU64(br); @@ -61,7 +61,7 @@ GCSFilter.prototype.matchAny = function matchAny(key, items) { assert(items.length > 0); const br = new BitReader(this.data); - const last1 = new Int64(0); + const last1 = new U64(0); const values = []; for (const item of items) { @@ -111,7 +111,7 @@ GCSFilter.prototype.readU64 = function readU64(br) { }; GCSFilter.prototype._readU64 = function _readU64(br) { - const num = new Int64(0); + const num = new U64(0); // Unary while (br.readBit()) @@ -166,7 +166,7 @@ GCSFilter.prototype.fromItems = function fromItems(P, key, items) { this.n = items.length; this.p = P; - this.m = Int64(this.n).ishln(this.p); + this.m = U64(this.n).ishln(this.p); const values = []; @@ -179,7 +179,7 @@ GCSFilter.prototype.fromItems = function fromItems(P, key, items) { values.sort(compare); const bw = new BitWriter(); - let last = new Int64(0); + let last = new U64(0); for (const hash of values) { const rem = hash.sub(last).imaskn(this.p); @@ -210,7 +210,7 @@ GCSFilter.prototype.fromBytes = function fromBytes(N, P, data) { this.n = N; this.p = P; - this.m = Int64(this.n).ishln(this.p); + this.m = U64(this.n).ishln(this.p); this.data = data; return this; @@ -490,7 +490,7 @@ BitReader.prototype.readBits64 = function readBits64(count) { assert(count >= 0); assert(count <= 64); - const num = new Int64(); + const num = new U64(); if (count > 32) { num.hi = this.readBits(count - 32); @@ -512,7 +512,7 @@ function compare(a, b) { function siphash24(data, key) { const [hi, lo] = siphash(data, key); - return new Int64().join(hi, lo); + return U64.fromBits(hi, lo); } function getPushes(items, script) { diff --git a/package.json b/package.json index 74c58158..3812a752 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "dependencies": { "bn.js": "4.11.7", "elliptic": "6.4.0", - "n64": "0.0.13" + "n64": "0.0.14" }, "optionalDependencies": { "bcoin-native": "0.0.23",