@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.
13 lines (12 loc) • 475 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isPowerOfTwo = isPowerOfTwo;
exports.nextPowerOfTwo = nextPowerOfTwo;
/** @internal Returns whether `value` is a positive power of two. */
function isPowerOfTwo(value) {
return value > 0 && (value & (value - 1)) === 0;
}
/** @internal Returns the smallest power of two greater than or equal to `value`. */
function nextPowerOfTwo(value) {
return 2 ** Math.ceil(Math.log2(value));
}