📄 位运算简介及实用技巧(一):基础篇.htm
字号:
<DIV class=commentcontent
id=commcontent_1799>取末k位
| (1101101->1101,k=5) | x and (1 shl
k-1)<BR><BR>依然觉得这句话有问题,上面说取末K位,且K=5,为什么转化后只有4位<BR>应该改成是 x and (1 shl
(k+1)-1)</DIV></DIV>
<DIV class=comment>
<DIV class=commenttop><A href="javascript:addQuote('方力','commcontent_1727')"
name=comm_1727><IMG style="MARGIN: 0px 4px -3px 0px" alt=""
src="位运算简介及实用技巧(一):基础篇.files/icon_quote.gif" border=0></A> <A
href="http://www.matrix67.com/blog/member.asp?action=view&memName=%E6%96%B9%E5%8A%9B"
target=_blank><STRONG>方力</STRONG></A> <SPAN class=commentinfo>[楼层: 17楼 发表时间:
2007-10-23 11:29 AM]</SPAN></DIV>
<DIV class=commentcontent
id=commcontent_1727>补充一下什么叫原码,反码,补码,<BR>原码,二进制中第一个数表示是正数还是负数(如matrix67所说)
,剩下的数表示所要表示的数的绝对值.<BR> 比如,0010=2, 1010=-2<BR>反码,因为原码在计算机中不方便,引入了反码,反码就是负数在二进制中除了第一个数表示符号外,其他的数都<BR> 依次取反,比如127=01111111,而-127=10000000;<BR>补码,虽然反码方便但是在计算中会错(正数和负数的计算),因为0000=0,1111=-0=0;有两个数表示<BR> 同一个数,所以在计算中会少一,补码就是在负数的反码上加上一。<BR> 比如-5=11111010(反码),补码为-5=11111011。<BR> <BR><BR><SPAN
style="COLOR: red">回复:不错,谢谢补充!</SPAN></DIV></DIV>
<DIV class=comment>
<DIV class=commenttop><A href="javascript:addQuote('逆铭','commcontent_1675')"
name=comm_1675><IMG style="MARGIN: 0px 4px -3px 0px" alt=""
src="位运算简介及实用技巧(一):基础篇.files/icon_quote.gif" border=0></A> <A
href="http://blog.sina.com.cn/tomtung" target=_blank><STRONG>逆铭</STRONG></A>
<SPAN class=commentinfo>[楼层: 16楼 发表时间: 2007-10-15 08:46 PM]</SPAN></DIV>
<DIV class=commentcontent id=commcontent_1675>觉得也许有必要介绍C++的bitset...</DIV></DIV>
<DIV class=comment>
<DIV class=commenttop><A href="javascript:addQuote('人贱合一','commcontent_1016')"
name=comm_1016><IMG style="MARGIN: 0px 4px -3px 0px" alt=""
src="位运算简介及实用技巧(一):基础篇.files/icon_quote.gif" border=0></A> 人贱合一 <SPAN
class=commentinfo>[楼层: 15楼 发表时间: 2007-08-05 05:56 PM]</SPAN></DIV>
<DIV class=commentcontent id=commcontent_1016>谢谢了,<BR>位运算有个质的飞越...</DIV></DIV>
<DIV class=comment>
<DIV class=commenttop><A href="javascript:addQuote('camily','commcontent_983')"
name=comm_983><IMG style="MARGIN: 0px 4px -3px 0px" alt=""
src="位运算简介及实用技巧(一):基础篇.files/icon_quote.gif" border=0></A> <A
href="http://www.matrix67.com/blog/member.asp?action=view&memName=camily"
target=_blank><STRONG>camily</STRONG></A> <SPAN class=commentinfo>[楼层: 14楼 发表时间:
2007-08-02 11:16 AM]</SPAN></DIV>
<DIV class=commentcontent
id=commcontent_983>取右边连续的1 |
(100101111->1111) | (x xor
(x+1)) shr
1<BR><BR>发现一个更有意思的计算:<BR>取右边连续的1
| (100101111->1111) | x - x
and (x+1)<BR><BR><SPAN style="COLOR: red">回复:有意思;但是这个减法……耗时了</SPAN></DIV></DIV>
<DIV class=comment>
<DIV class=commenttop><A href="javascript:addQuote('Ronice','commcontent_943')"
name=comm_943><IMG style="MARGIN: 0px 4px -3px 0px" alt=""
src="位运算简介及实用技巧(一):基础篇.files/icon_quote.gif" border=0></A> <A
href="http://www.matrix67.com/blog/member.asp?action=view&memName=Ronice"
target=_blank><STRONG>Ronice</STRONG></A> <SPAN class=commentinfo>[楼层:
12a楼 发表时间: 2007-07-27 11:26 PM]</SPAN></DIV>
<DIV class=commentcontent id=commcontent_943>抱歉——没看到是0 <IMG
style="MARGIN: 0px 0px -2px" alt="" src="位运算简介及实用技巧(一):基础篇.files/Face_09.gif"
border=0><BR> 有点用余光看文章…… - -||||</DIV></DIV>
<DIV class=pageContent>
<DIV class=page style="FLOAT: right">
<UL>
<LI class=pageNumber><STRONG>1</STRONG> | <A
href="http://www.matrix67.com/blog/article.asp?id=311&page=2#comm_top">2</A>
| <A
href="http://www.matrix67.com/blog/article.asp?id=311&page=3#comm_top">3</A>
| <A title=下一页 style="TEXT-DECORATION: none"
href="http://www.matrix67.com/blog/article.asp?id=311&page=2"></A><A
title=最后一页 style="TEXT-DECORATION: none"
href="http://www.matrix67.com/blog/article.asp?id=311&page=3#comm_top">></A></LI></UL></DIV></DIV>
<DIV id=MsgContent style="WIDTH: 94%">
<DIV id=MsgHead>发表评论</DIV>
<DIV id=MsgBody>
<FORM style="MARGIN: 0px" name=frm onsubmit="return CheckPost()"
action=blogcomm.asp method=post>
<TABLE cellSpacing=0 cellPadding=0 width="100%">
<TBODY>
<TR>
<TD align=right width=70><STRONG>昵 称:</STRONG></TD>
<TD
style="PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; PADDING-TOP: 3px"
align=left><INPUT class=userpass maxLength=24 size=18 name=username></TD></TR>
<TR>
<TD align=right width=70><STRONG>密 码:</STRONG></TD>
<TD
style="PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; PADDING-TOP: 3px"
align=left><INPUT class=userpass type=password maxLength=24 size=18
name=password> 游客发言不需要密码.</TD></TR>
<TR>
<TD align=right width=70><STRONG>验证码:</STRONG></TD>
<TD
style="PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; PADDING-TOP: 3px"
align=left><INPUT class=userpass maxLength=4 size=4 name=validate> <IMG
style="MARGIN-RIGHT: 8px" alt=""
src="位运算简介及实用技巧(一):基础篇.files/getcode.htm"></TD></TR>
<TR>
<TD vAlign=top align=right width=70><STRONG>内 容:</STRONG><BR></TD>
<TD
style="PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; PADDING-TOP: 2px">
<SCRIPT language=javascript src="位运算简介及实用技巧(一):基础篇.files/UBBCode.js"
type=text/javascript></SCRIPT>
<SCRIPT language=javascript src="位运算简介及实用技巧(一):基础篇.files/UBBCode_help.js"
type=text/javascript></SCRIPT>
<DIV class=UBBSmiliesPanel id=UBBSmiliesPanel>
<TABLE cellSpacing=2 cellPadding=0>
<TBODY>
<TR>
<TD><A class=Smilie title=[smile]
href="javascript:AddSmiley('[smile]')"><IMG alt=""
src="位运算简介及实用技巧(一):基础篇.files/Face_01.gif" border=0></A></TD>
<TD><A class=Smilie title=[lol]
href="javascript:AddSmiley('[lol]')"><IMG alt=""
src="位运算简介及实用技巧(一):基础篇.files/Face_02.gif" border=0></A></TD>
<TD><A class=Smilie title=[wink]
href="javascript:AddSmiley('[wink]')"><IMG alt=""
src="位运算简介及实用技巧(一):基础篇.files/Face_03.gif" border=0></A></TD>
<TD><A class=Smilie title=[eek]
href="javascript:AddSmiley('[eek]')"><IMG alt=""
src="位运算简介及实用技巧(一):基础篇.files/Face_04.gif" border=0></A></TD>
<TD><A class=Smilie title=[razz]
href="javascript:AddSmiley('[razz]')"><IMG alt=""
src="位运算简介及实用技巧(一):基础篇.files/Face_05.gif" border=0></A></TD>
<TD><A class=Smilie title=[cool]
href="javascript:AddSmiley('[cool]')"><IMG alt=""
src="位运算简介及实用技巧(一):基础篇.files/Face_06.gif" border=0></A></TD>
<TD><A class=Smilie title=[angry]
href="javascript:AddSmiley('[angry]')"><IMG alt=""
src="位运算简介及实用技巧(一):基础篇.files/Face_07.gif" border=0></A></TD>
<TD><A class=Smilie title=[redface]
href="javascript:AddSmiley('[redface]')"><IMG alt=""
src="位运算简介及实用技巧(一):基础篇.files/Face_08.gif" border=0></A></TD></TR>
<TR>
<TD><A class=Smilie title=[muteness]
href="javascript:AddSmiley('[muteness]')"><IMG alt=""
src="位运算简介及实用技巧(一):基础篇.files/Face_09.gif" border=0></A></TD>
<TD><A class=Smilie title=[sad]
href="javascript:AddSmiley('[sad]')"><IMG alt=""
src="位运算简介及实用技巧(一):基础篇.files/Face_10.gif" border=0></A></TD>
<TD><A class=Smilie title=[cry]
href="javascript:AddSmiley('[cry]')"><IMG alt=""
src="位运算简介及实用技巧(一):基础篇.files/Face_11.gif" border=0></A></TD>
<TD><A class=Smilie title=[stun]
href="javascript:AddSmiley('[stun]')"><IMG alt=""
src="位运算简介及实用技巧(一):基础篇.files/Face_12.gif" border=0></A></TD>
<TD><A class=Smilie title=[Belial]
href="javascript:AddSmiley('[Belial]')"><IMG alt=""
src="位运算简介及实用技巧(一):基础篇.files/Face_13.gif" border=0></A></TD>
<TD><A class=Smilie title=[angel]
href="javascript:AddSmiley('[angel]')"><IMG alt=""
src="位运算简介及实用技巧(一):基础篇.files/Face_14.gif" border=0></A></TD>
<TD><A class=Smilie title=[heart]
href="javascript:AddSmiley('[heart]')"><IMG alt=""
src="位运算简介及实用技巧(一):基础篇.files/Face_15.gif" border=0></A></TD>
<TD><A class=Smilie title=[breakheart]
href="javascript:AddSmiley('[breakheart]')"><IMG alt=""
src="位运算简介及实用技巧(一):基础篇.files/Face_16.gif" border=0></A></TD></TR>
<TR>
<TD><A class=Smilie title=[MSN]
href="javascript:AddSmiley('[MSN]')"><IMG alt=""
src="位运算简介及实用技巧(一):基础篇.files/Face_17.gif" border=0></A></TD>
<TD><A class=Smilie title=[cat]
href="javascript:AddSmiley('[cat]')"><IMG alt=""
src="位运算简介及实用技巧(一):基础篇.files/Face_18.gif" border=0></A></TD>
<TD><A class=Smilie title=[dog]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -