Skip to content

prevPow2

Subhajit Sahu edited this page Feb 3, 2021 · 9 revisions

Gets previous power-of-2. 🏃 📼 📦 🌔 📒

Similar: log2, pow2, isPow2, nextPow2, prevPow2.

integer.prevPow2(x);
// x: an int32
const integer = require("extra-integer");

integer.prevPow2(63);
// 32

integer.prevPow2(128);
// 128

integer.prevPow2(1);
// 1

references

Clone this wiki locally