File tree Expand file tree Collapse file tree 1 file changed +14
-17
lines changed Expand file tree Collapse file tree 1 file changed +14
-17
lines changed Original file line number Diff line number Diff line change @@ -161,18 +161,17 @@ export class SftpPacketReader extends SftpPacket {
161
161
}
162
162
163
163
readInt64 ( ) : number {
164
- const hi = this . readInt32 ( ) ;
165
- const lo = this . readUInt32 ( ) ;
166
-
167
- const value = hi * 0x100000000 + lo ;
168
- return value ;
164
+ this . check ( 8 ) ;
165
+ const value = this . buffer . readBigInt64BE ( this . position ) ;
166
+ this . position += 8 ;
167
+ return Number ( value ) ;
169
168
}
170
169
171
170
readUInt64 ( ) : number {
172
- const hi = this . readUInt32 ( ) ;
173
- const lo = this . readUInt32 ( ) ;
174
- const value = hi * 0x100000000 + lo ;
175
- return value ;
171
+ this . check ( 8 ) ;
172
+ const value = this . buffer . readBigUint64BE ( this . position ) ;
173
+ this . position += 8 ;
174
+ return Number ( value ) ;
176
175
}
177
176
178
177
readString ( ) : string {
@@ -271,17 +270,15 @@ export class SftpPacketWriter extends SftpPacket {
271
270
}
272
271
273
272
writeInt64 ( value : number ) : void {
274
- const hi = ( value / 0x100000000 ) | 0 ;
275
- const lo = ( value & 0xffffffff ) | 0 ;
276
- this . writeInt32 ( hi ) ;
277
- this . writeInt32 ( lo ) ;
273
+ this . check ( 8 ) ;
274
+ this . buffer . writeBigInt64BE ( BigInt ( value ) , this . position ) ;
275
+ this . position += 8 ;
278
276
}
279
277
280
278
writeUInt64 ( value : number ) : void {
281
- const hi = ( value / 0x100000000 ) | 0 ;
282
- const lo = ( value & 0xffffffff ) | 0 ;
283
- this . writeUInt32 ( hi ) ;
284
- this . writeUInt32 ( lo ) ;
279
+ this . check ( 8 ) ;
280
+ this . buffer . writeBigUInt64BE ( BigInt ( value ) , this . position ) ;
281
+ this . position += 8 ;
285
282
}
286
283
287
284
writeString ( value : string ) : void {
You can’t perform that action at this time.
0 commit comments