1 | const MAX_INT32 = Math.pow(2, 32)
|
2 |
|
3 | module.exports = (value, buf = Buffer.allocUnsafe(8)) => {
|
4 | const high = Math.floor(value / MAX_INT32)
|
5 | const low = value % MAX_INT32
|
6 |
|
7 | buf.writeUInt32BE(high, 0)
|
8 | buf.writeUInt32BE(low, 4)
|
9 | return buf
|
10 | }
|