<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Oct 18, 2014 at 4:10 PM, Chris Angelico <span dir="ltr"><<a href="mailto:rosuav@gmail.com" target="_blank">rosuav@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">On Sat, Oct 18, 2014 at 6:02 PM, Artur Bercik <<a href="mailto:vbubbly21@gmail.com">vbubbly21@gmail.com</a>> wrote:<br>
> So, the  Bit No. 2-5 for the following case is '1101', right?<br>
><br>
> 1073741877: 1000000000000000000000000110101<br>
><br>
>  If my required bit combination for Bit No. 2-5 is '1011', then the above<br>
> number (1073741877) is not chosen, right??<br>
><br>
> Look forward to know your confirmation.<br>
<br>
</span>(Side point: Please don't top-post. The convention on this mailing<br>
list, and most other technical mailing lists, is what's sometimes<br>
called "interleaved style"; you trim the quoted text to what's needed<br>
for context, and put your text underneath what you're referring to.<br>
See <a href="https://en.wikipedia.org/wiki/Posting_style#Interleaved_style" target="_blank">https://en.wikipedia.org/wiki/Posting_style#Interleaved_style</a> for<br>
more info.)<br>
<br>
>>> 1073741877&60<br>
52<br>
>>> bin(52)<br>
'0b110100'<br>
<br>
Everything I've written with the triple-angle-bracket marker can be<br>
typed in at the Python prompt, and you'll see exactly what it does. In<br>
this case, you can see that you're absolutely right: 1073741877 has<br>
1101 in those positions, so if you're looking for 1011, it won't<br>
match:<br>
<br>
>>> 0b101100<br>
44<br>
<br>
However, 1073741869 would:<br>
<br>
>>> 1073741869&60<br>
44<br>
<br>
The way to test would be something like this:<br>
<br>
>>> (1073741877 & 0b111100) == 0b101100<br>
False<br>
>>> (1073741869 & 0b111100) == 0b101100<br>
True<br></blockquote><div><br></div>Thank you very much Chris Angelico, I have come to know it.<div><br></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
ChrisA<br>
<span class=""><font color="#888888">--<br>
<a href="https://mail.python.org/mailman/listinfo/python-list" target="_blank">https://mail.python.org/mailman/listinfo/python-list</a><br>
</font></span></blockquote></div><br></div></div>