MCPcopy Create free account
hub / github.com/denodrivers/postgres / readInt16BE

Function readInt16BE

utils/utils.ts:3–7  ·  view source on GitHub ↗
(buffer: Uint8Array, offset: number)

Source from the content-addressed store, hash-verified

1import { bold, yellow } from "@std/fmt/colors";
2
3export function readInt16BE(buffer: Uint8Array, offset: number): number {
4 offset = offset >>> 0;
5 const val = buffer[offset + 1] | (buffer[offset] << 8);
6 return val & 0x8000 ? val | 0xffff0000 : val;
7}
8
9export function readUInt16BE(buffer: Uint8Array, offset: number): number {
10 offset = offset >>> 0;

Callers 1

readInt16Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected