Initial commit
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
const MAX_INT32 = Math.pow(2, 32)
|
||||
|
||||
module.exports = (value, buf = Buffer.allocUnsafe(8)) => {
|
||||
const high = Math.floor(value / MAX_INT32)
|
||||
const low = value % MAX_INT32
|
||||
|
||||
buf.writeUInt32BE(high, 0)
|
||||
buf.writeUInt32BE(low, 4)
|
||||
return buf
|
||||
}
|
||||
Reference in New Issue
Block a user