minor optimizations.
This commit is contained in:
parent
c598937e4c
commit
92d95c552c
@ -178,8 +178,8 @@ Mnemonic.prototype.createMnemonic = function createMnemonic() {
|
|||||||
word = 0;
|
word = 0;
|
||||||
for (j = 0; j < 11; j++) {
|
for (j = 0; j < 11; j++) {
|
||||||
i++;
|
i++;
|
||||||
oct = i / 8 | 0;
|
|
||||||
bit = i % 8;
|
bit = i % 8;
|
||||||
|
oct = (i - bit) / 8;
|
||||||
word <<= 1;
|
word <<= 1;
|
||||||
word |= (entropy[oct] >>> (7 - bit)) & 1;
|
word |= (entropy[oct] >>> (7 - bit)) & 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1673,8 +1673,8 @@ utils.write64N = function write64N(dst, num, off, be) {
|
|||||||
|
|
||||||
assert(num <= utils.MAX_SAFE_INTEGER, 'Number exceeds 2^53-1');
|
assert(num <= utils.MAX_SAFE_INTEGER, 'Number exceeds 2^53-1');
|
||||||
|
|
||||||
hi = num / 0x100000000 | 0;
|
|
||||||
lo = num % 0x100000000;
|
lo = num % 0x100000000;
|
||||||
|
hi = (num - lo) / 0x100000000;
|
||||||
|
|
||||||
if (negative) {
|
if (negative) {
|
||||||
hi = ~hi >>> 0;
|
hi = ~hi >>> 0;
|
||||||
@ -1793,7 +1793,7 @@ utils.read64N = function read64N(data, off, force53, be) {
|
|||||||
|
|
||||||
assert((hi & 0xffe00000) === 0, 'Number exceeds 2^53-1');
|
assert((hi & 0xffe00000) === 0, 'Number exceeds 2^53-1');
|
||||||
|
|
||||||
return (hi * 0x100000000) + lo;
|
return hi * 0x100000000 + lo;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -162,7 +162,7 @@ describe('Chain', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should fail to mine a block with coins on a side chain', function(cb) {
|
it('should fail to mine a block with coins on an alternate chain', function(cb) {
|
||||||
mineBlock(null, cb1, function(err, block) {
|
mineBlock(null, cb1, function(err, block) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
deleteCoins(block.txs);
|
deleteCoins(block.txs);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user