Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ext/node/polyfills/internal_binding/_listen.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Copyright 2018-2025 the Deno authors. MIT license.

// TODO(petamoriken): enable prefer-primordials for node polyfills
// deno-lint-ignore-file prefer-primordials
import { primordials } from "ext:core/mod.js";
const { MathClz32 } = primordials;

/**
* @param n Number to act on.
* @return The number rounded up to the nearest power of 2.
*/
export function ceilPowOf2(n: number) {
const roundPowOf2 = 1 << (31 - Math.clz32(n));
const roundPowOf2 = 1 << (31 - MathClz32(n));

return roundPowOf2 < n ? roundPowOf2 * 2 : roundPowOf2;
}
Expand Down
Loading