MCPcopy Create free account
hub / github.com/Effect-TS/effect / writeInt64

Function writeInt64

packages/sql/pg/src/PgTypes.ts:96–100  ·  view source on GitHub ↗
(bytes: Uint8Array, offset: number, value: number)

Source from the content-addressed store, hash-verified

94
95/** Writes an int64, given a value the caller has checked fits a double exactly. */
96const writeInt64 = (bytes: Uint8Array, offset: number, value: number): void => {
97 const high = Math.floor(value / 4294967296)
98 writeInt32(bytes, offset, high)
99 writeInt32(bytes, offset + 4, value - high * 4294967296)
100}
101
102const readUint32 = (bytes: Uint8Array, offset: number): number =>
103 ((bytes[offset] << 24) | (bytes[offset + 1] << 16) | (bytes[offset + 2] << 8) | bytes[offset + 3]) >>> 0

Callers 1

PgTypes.tsFile · 0.85

Calls 1

writeInt32Function · 0.85

Tested by

no test coverage detected