Skip to content

signExtend

Subhajit Sahu edited this page Jan 24, 2021 · 5 revisions

Sign extend variable bit-width integer. 📰 📘


signExtend x w
-- x: variable bit-width integer
-- w: bit width (32)
import Bit exposing (..)

signExtend 15 4
-- -1 (1111 ⇒ -1)

signExtend 3 3
-- 3  (011 ⇒ 3)

signExtend 4 3
-- -4 (100 ⇒ -4)


References

Clone this wiki locally