Commit 3234bb6 1 parent 9f03e47 commit 3234bb6 Copy full SHA for 3234bb6
File tree 3 files changed +7
-3
lines changed
3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 126
126
"release" : " aegir release"
127
127
},
128
128
"dependencies" : {
129
+ "uint8-varint" : " ^2.0.2" ,
129
130
"uint8arraylist" : " ^2.4.3" ,
130
131
"uint8arrays" : " ^5.0.1"
131
132
},
Original file line number Diff line number Diff line change
1
+ import { decodeUint8Array , encodingLength } from 'uint8-varint'
1
2
import { readFloatLE , readDoubleLE } from './float.js'
2
3
import { LongBits } from './longbits.js'
3
4
import * as utf8 from './utf8.js'
@@ -304,7 +305,9 @@ export class Uint8ArrayReader implements Reader {
304
305
* JavaScript number
305
306
*/
306
307
uint64Number ( ) : number {
307
- return this . readLongVarint ( ) . toNumber ( true )
308
+ const value = decodeUint8Array ( this . buf , this . pos )
309
+ this . pos += encodingLength ( value )
310
+ return value
308
311
}
309
312
310
313
/**
Original file line number Diff line number Diff line change
1
+ import { encodeUint8Array , encodingLength } from 'uint8-varint'
1
2
import { allocUnsafe } from 'uint8arrays/alloc'
2
3
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
3
4
import { writeFloatLE , writeDoubleLE } from './float.js'
@@ -186,8 +187,7 @@ class Uint8ArrayWriter implements Writer {
186
187
* Writes an unsigned 64 bit value as a varint
187
188
*/
188
189
uint64Number ( value : number ) : this {
189
- const bits = LongBits . fromNumber ( value )
190
- return this . _push ( writeVarint64 , bits . length ( ) , bits )
190
+ return this . _push ( encodeUint8Array , encodingLength ( value ) , value )
191
191
}
192
192
193
193
/**
You can’t perform that action at this time.
0 commit comments