UNPKG

@morpho-org/midnight-sdk

Version:

Viem-based package for Morpho Midnight that exports protocol utilities, fetch helpers, and Midnight API utilities under a dedicated API subpath.

9 lines (8 loc) • 334 B
/** @internal Returns whether `value` is a positive power of two. */ export function isPowerOfTwo(value) { return value > 0 && (value & (value - 1)) === 0; } /** @internal Returns the smallest power of two greater than or equal to `value`. */ export function nextPowerOfTwo(value) { return 2 ** Math.ceil(Math.log2(value)); }