16 lines
566 B
JavaScript
16 lines
566 B
JavaScript
import { bswap32 } from "../decoding/fastPforShared";
|
|
/**
|
|
* Serializes an `Int32Array` to a big-endian byte stream.
|
|
*
|
|
* @param values - Int32 words to serialize.
|
|
* @returns Big-endian byte stream (`values.length * 4` bytes).
|
|
*/
|
|
export function encodeBigEndianInt32s(values) {
|
|
const bytes = new Uint8Array(values.length * 4);
|
|
const u32 = new Uint32Array(bytes.buffer, bytes.byteOffset, values.length);
|
|
for (let i = 0; i < values.length; i++) {
|
|
u32[i] = bswap32(values[i]);
|
|
}
|
|
return bytes;
|
|
}
|
|
//# sourceMappingURL=bigEndianEncode.js.map
|