deno.land / std@0.173.0 / io / slice_long_to_bytes.ts

slice_long_to_bytes.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
/** * Slice number into 64bit big endian byte array * @param d The number to be sliced * @param dest The sliced array */export function sliceLongToBytes( d: number, dest = Array.from<number>({ length: 8 }),): number[] { let big = BigInt(d); for (let i = 0; i < 8; i++) { dest[7 - i] = Number(big & 0xffn); big >>= 8n; } return dest;}
std

Version Info

Tagged at
a year ago