hex.sign_extendΒΆ
sign-extends hex[:signed_n] into hex[:full_n]
SignatureΒΆ
def sign_extend full_n, signed_n, hex @ negative, positive { ... }
Defined in hex/math_basic.fj β lines 212β218 (view on GitHub).
ComplexityΒΆ
Time:
(full_n - signed_n)(@+4)Space:
(full_n - signed_n)(@+16)
See the complexity glossary for what @, w, dw, dbit, n mean.
SourceΒΆ
Click to view the macro body
def sign_extend full_n, signed_n, hex @ negative, positive {
.zero full_n - signed_n, hex + signed_n * dw
.sign signed_n, hex, negative, positive
negative:
.not full_n - signed_n, hex + signed_n * dw
positive:
}
Depends onΒΆ
β Previous: hex.abs