<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I'm trying to reason about how to find certain bit positions of the absolute value of a given integer value. Specifically, I want to know the highest possibly set bit and lowest possibly set bit of the absolute value, in order to find the range between the two.</div><div class=""><br class=""></div><div class="">Note that I'm specifically trying to be as conservative as possible.<br class=""><div class=""><br class=""></div><div class="">This is what I have so far:</div><div class=""><br class=""></div><div class="">If the sign bit of the original integer is a known 0 (known positive) - the highest possibly set bit is the highest bit not known to be zero, and the lowest possibly set bit is the lowest bit not known to be zero.</div><div class=""><br class=""></div><div class="">If the sign bit of the original integer is a known 1 (known negative) - the highest possibly set bit is the one *to the left of* the *lowest* bit not known to be one (unless that would be the sign bit, in which case it is replaced with the bit to the right of the sign bit), and the lowest possibly set bit is the lowest bit not known to be zero, UNLESS *every* bit other than the sign bit is not known to be one, in which case the highest possibly set bit is the sign bit.</div><div class=""><br class=""></div><div class="">If the sign bit of the original integer is unknown - same as if known negative, except the highest possibly set bit is initially the higher of the two rules for highest possibly set bit.</div><div class=""><br class=""></div><div class="">Is this correct? Can it be less conservative in certain situations? Are there any times where we know that only one of the highest and lowest possibly set bits can actually be set?</div><div class=""><br class=""></div><div class="">I apologize for any headaches this causes.</div><div class=""><div class="">
<br class="Apple-interchange-newline"><span style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;" class=""> - CL</span>

</div>
<br class=""></div></div></body></html>