avancement planning
This commit is contained in:
+6
-1
@@ -212,7 +212,12 @@ function readKey(buffer, start, end, inSequence) {
|
||||
let size = end - position;
|
||||
let lowInt;
|
||||
if (size > 4) {
|
||||
lowInt = dataView.getInt32(position + 4);
|
||||
lowInt = position + 8 <= buffer.length ? dataView.getInt32(position + 4) : (
|
||||
buffer[position + 4] << 24 |
|
||||
buffer[position + 5] << 16 |
|
||||
buffer[position + 6] << 8 |
|
||||
buffer[position + 7]
|
||||
);
|
||||
highInt |= lowInt >>> 28;
|
||||
if (size <= 6) { // clear the last bits
|
||||
lowInt &= -0x10000;
|
||||
|
||||
+6
-1
@@ -208,7 +208,12 @@ export function readKey(buffer, start, end, inSequence) {
|
||||
let size = end - position
|
||||
let lowInt
|
||||
if (size > 4) {
|
||||
lowInt = dataView.getInt32(position + 4)
|
||||
lowInt = position + 8 <= buffer.length ? dataView.getInt32(position + 4) : (
|
||||
buffer[position + 4] << 24 |
|
||||
buffer[position + 5] << 16 |
|
||||
buffer[position + 6] << 8 |
|
||||
buffer[position + 7]
|
||||
)
|
||||
highInt |= lowInt >>> 28
|
||||
if (size <= 6) { // clear the last bits
|
||||
lowInt &= -0x10000
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ordered-binary",
|
||||
"author": "Kris Zyp",
|
||||
"version": "1.6.0",
|
||||
"version": "1.6.1",
|
||||
"description": "Conversion of JavaScript primitives to and from Buffer with binary order matching natural primitive order",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
+2
@@ -28,6 +28,8 @@ suite('key buffers', () => {
|
||||
assert.strictEqual(fromBufferKey(toBufferKey(3.4)), 3.4)
|
||||
assert.strictEqual(fromBufferKey(toBufferKey(Math.PI)), Math.PI)
|
||||
assert.strictEqual(fromBufferKey(toBufferKey(2002225)), 2002225)
|
||||
// check to make sure it works with a limited ArrayBuffer
|
||||
assert.strictEqual(fromBufferKey(new Uint8Array(toBufferKey(2002225))), 2002225)
|
||||
assert.strictEqual(fromBufferKey(toBufferKey(9377288)), 9377288)
|
||||
assert.strictEqual(fromBufferKey(toBufferKey(1503579323825)), 1503579323825)
|
||||
assert.strictEqual(fromBufferKey(toBufferKey(1503579323825.3523532)), 1503579323825.3523532)
|
||||
|
||||
Reference in New Issue
Block a user