锘??xml version="1.0" encoding="utf-8" standalone="yes"?>激情欧美日韩一区,中文av字幕一区,亚洲成色777777女色窝http://m.shnenglu.com/Chipset/category/9274.htmlzh-cnFri, 20 Aug 2021 02:32:36 GMTFri, 20 Aug 2021 02:32:36 GMT60鏈變附瀹夊縐戞櫘鍏?/title><link>http://m.shnenglu.com/Chipset/archive/2021/08/13/217779.html</link><dc:creator>灞卞縐戞妧</dc:creator><author>灞卞縐戞妧</author><pubDate>Fri, 13 Aug 2021 13:17:00 GMT</pubDate><guid>http://m.shnenglu.com/Chipset/archive/2021/08/13/217779.html</guid><wfw:comment>http://m.shnenglu.com/Chipset/comments/217779.html</wfw:comment><comments>http://m.shnenglu.com/Chipset/archive/2021/08/13/217779.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.shnenglu.com/Chipset/comments/commentRss/217779.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/Chipset/services/trackbacks/217779.html</trackback:ping><description><![CDATA[<p class="MsoNormal"><span lang="ZH-CN" style="font-size: 10pt; font-family: " comic="" sans="" ms";"="" ms";="" font-size:="" 10pt;"="">閴翠簬灝忓鑻辮</span><span style="font-size: 10pt; font-family: " comic="" sans="" ms";"="">Reach G(絎?鍐?</span><span lang="ZH-CN" style="font-size: 10pt; font-family: " comic="" sans="" ms";"="" ms";="" font-size:="" 10pt;"="">涓婄殑涓綃囨枃绔?/span><span style="font-size: 10pt; font-family: " comic="" sans="" ms";"="">The Girl Who Fell from the Sky</span><span lang="ZH-CN" style="font-size: 10pt; font-family: " comic="" sans="" ms";"="" ms";="" font-size:="" 10pt;"="">錛?a href="http://m.shnenglu.com/Chipset/archive/2021/08/11/217695.html">鍦ㄨ繖閲?/a>銆備簬鏄墦綆椾簡瑙d竴涓嬩綔鑰?涓諱漢鍏?鏈變附瀹夊縐戞櫘鍏?/span><span style="font-size: 10pt; font-family: " comic="" sans="" ms";"="">(</span><span lang="ZH-CN" style="font-size: 10pt; font-family: " comic="" sans="" ms";"="" ms";="" font-size:="" 10pt;"="">鏈變附瀹夊榪媺</span><span style="font-size: 10pt; font-family: " comic="" sans="" ms";"="">)</span><span lang="ZH-CN" style="font-size: 10pt; font-family: " comic="" sans="" ms";"="" ms";="" font-size:="" 10pt;"="">銆?/span><span style="font-size: 10pt; font-family: " comic="" sans="" ms";"="" ms";="" font-size:="" 10pt;"="" 13.3333px;"="">浜虹墿浠嬬粛</span><span style="font-size: 10pt; font-family: " comic="" sans="" ms";"="" ms";="" font-size:="" 10pt;"="">閫夎嚜E鏂囩淮鍩猴紝浠ヤ笅涓鴻瘧鏂囥?/span><span style="font-family: " comic="" sans="" ms";"="" ms";="" font-size:="" 10pt;"=""><br /></span><span style="font-size: 10pt;" comic="" sans="" ms";="" font-size:="" 10pt;"="">PS: </span><span style="font-size: 10pt;" comic="" sans="" ms";="" font-size:="" 13.3333px;"="">緲昏瘧鑳藉緢濂界殑璁粌涓涓漢鐨勮嫳璇拰姹夎鍙ュ瓙緇勭粐鑳藉姏錛屾椂涓嶆椂鐨勮瀛﹁嫳璇殑濞冨皾璇曚竴涓嬬炕璇戣嫳璇鏂囦篃綆楁槸鏌愮閿葷偧鍚с?/span></p><p class="MsoNormal"><span lang="ZH-CN" style="font-family: " comic="" sans="" ms";="" font-size:="" 10pt;"=""></span><span lang="ZH-CN" style="font-family: " comic="" sans="" ms";="" font-size:="" 10pt;"=""><br /></span><o:p></o:p></p><p class="MsoNormal" style="margin-top:6.0pt;margin-right:0in;margin-bottom:6.0pt; margin-left:0in;line-height:normal"><span style="font-family: DengXian; font-size: 12pt;">鏈變附瀹夊縐戞櫘鍏?/span><span style="font-size: 12pt;">(</span><span style="font-family: DengXian; font-size: 12pt;">鍑虹敓浜?/span><span style="font-size: 12pt;">1954</span><span style="font-family: DengXian; font-size: 12pt;">騫?/span><span style="font-size: 12pt;">10</span><span style="font-family: DengXian; font-size: 12pt;">鏈?/span><span style="font-size: 12pt;">10</span><span style="font-family: DengXian; font-size: 12pt;">鏃?/span><span style="font-size: 12pt;">)</span><span style="font-family: DengXian; font-size: 12pt;">錛屽鍚庡悕瀛楁湵涓藉畨濞滆開鎷夛紝鏄竴涓痙鍥?/span><span style="font-size: 12pt;">-</span><span style="font-family: DengXian; font-size: 12pt;">縐橀瞾鍝轟鉤鍔ㄧ墿瀛﹀銆傚ス鏄?/span><span style="font-size: 12pt;">1971</span><span style="font-family: DengXian; font-size: 12pt;">騫村叞钀?/span><span style="font-size: 12pt;">508</span><span style="font-family: DengXian; font-size: 12pt;">鑸彮絀洪毦鐨勫敮涓騫稿瓨鑰咃紝絀洪毦鍙戠敓鍚庣嫭鑷竴浜哄湪浜氶┈閫婄儹甯﹂洦鏋楃敓媧諱簡</span><span style="font-size: 12pt;">11</span><span style="font-family: DengXian; font-size: 12pt;">澶┿備粬浠?/span><span style="font-size: 12pt;">3000</span><span style="font-family: DengXian; font-size: 12pt;">綾?/span><span style="font-size: 12pt;">(9843</span><span style="font-family: DengXian; font-size: 12pt;">鑻卞昂</span><span style="font-size: 12pt;">)</span><span style="font-family: DengXian; font-size: 12pt;">鍧犺惤錛岃惤鍦版椂浠嶇劧琚畨鍏ㄥ甫鎹嗗湪搴ф涓娿?br /><br /></span></p> <p><strong><span style="font-family: DengXian; font-size: 12pt;">浜嬪墠</span></strong></p> <p><span style="font-family: DengXian; font-size: 12pt;">鏈變附瀹夊浜?/span><span style="font-size: 12pt;">1954</span><span style="font-family: DengXian; font-size: 12pt;">騫村嚭鐢熶簬縐橀瞾鍒╅┈錛岀埗姣嶉兘鏄湪鍒╅┈鑷劧鍘嗗彶鍗氱墿棣嗗伐浣滅殑寰峰浗浜恒傚ス鏄敓鐗╁瀹舵眽鏂▉寤夌鏅厠鍜岄笩綾誨瀹剁帥涓戒簹縐戞櫘鍏嬬殑鍞竴瀛╁瓙銆傚湪鏈變附瀹夊</span><span style="font-size: 12pt;">14</span><span style="font-family: DengXian; font-size: 12pt;">宀佹椂錛屽叾鐖舵瘝甯﹀ス鍘諱簹椹婇洦鏋楀緩閫犵爺絀跺熀鍦?/span><span style="font-size: 12pt;">--</span><span style="font-family: DengXian; font-size: 12pt;">娼樺彜閭c傚湪榪欓噷濂規垚浜嗕竴涓?#8220;涓涙灄瀛╁瓙”錛屽浜嗛噹澶栫敓瀛樻妧鑳姐傛暀鑲插綋灞涓嶅悓鎰忚繖鏍峰仛錛岃姹傛湵鑾夊畨濞滃洖鍒板埄椹簹鍘嗗北澶у啹媧牎寰鋒剰蹇楀鏍″弬鍔犺冭瘯銆傚ス浜?/span><span style="font-size: 12pt;">1971</span><span style="font-family: DengXian; font-size: 12pt;">騫?/span><span style="font-size: 12pt;">12</span><span style="font-family: DengXian; font-size: 12pt;">鏈?/span><span style="font-size: 12pt;">23</span><span style="font-family: DengXian; font-size: 12pt;">鏃ュ湪姝ゆ牎姣曚笟銆?br /><br /></span></p> <p><strong><span style="font-family: DengXian; font-size: 12pt;">絀洪毦</span></strong></p> <p><span style="font-family: DengXian; font-size: 12pt;">鏈變附瀹夊縐戞櫘鍏嬪湪緇忓巻紓ㄩ毦涓婃湁鍙岄噸鐢熷瓨鏁呬簨鍙緵璁茶堪銆傚湪</span><span style="font-size: 12pt;">1971</span><span style="font-family: DengXian; font-size: 12pt;">騫村湥璇炶妭鍓嶅錛屾湵涓藉畨濞滄惌涔樹簡鍏拌惃</span><span style="font-size: 12pt;">508</span><span style="font-family: DengXian; font-size: 12pt;">鑸彮銆傞偅鏃跺ス鍒氫粠楂樹腑姣曚笟錛屽ス鐨勬瘝浜茬帥涓戒簹鏈墦綆楀湪</span><span style="font-size: 12pt;">1971</span><span style="font-family: DengXian; font-size: 12pt;">騫?/span><span style="font-size: 12pt;">12</span><span style="font-family: DengXian; font-size: 12pt;">鏈?/span><span style="font-size: 12pt;">19-20</span><span style="font-family: DengXian; font-size: 12pt;">鏃ュ甫鐫濂沖効鍘繪綐鍙ら偅錛屼絾鏄湵涓藉畨濞滃笇鏈涜兘鍦?/span><span style="font-size: 12pt;">12</span><span style="font-family: DengXian; font-size: 12pt;">鏈?/span><span style="font-size: 12pt;">23</span><span style="font-family: DengXian; font-size: 12pt;">鏃ュ幓鍒╅┈鍙傚姞姣曚笟鍏哥ぜ銆傜帥涓戒簹鍚屾剰錛屾墦綆楀湥璇炶妭鍓嶅鍐嶉寰娼樺彜閭o紝鍙槸闄や簡閲屽凹鎬濆悰鐗規鑸┖</span><span style="font-size: 12pt;">(</span><span style="font-family: DengXian; font-size: 12pt;">鍏拌惃</span><span style="font-size: 12pt;">)</span><span style="font-family: DengXian; font-size: 12pt;">榪樻湁絀轟綑鍏朵綑鎵鏈夎埅鐝殑甯綅鍧囧凡鍞絼銆傚敖綆′笀澶眽鏂▉寤夊己鐑堣姹傚瀛愪笉瑕佷箻鍧愰偅瀹惰埅絀哄叕鍙哥殑鑸彮錛屽洜涓鴻鑸┖鍏徃鏃╁凡鑷悕鏄憲錛屼絾鏈緇堝ス浠繕鏄瀹氫簡鏈虹エ銆傞鏈鴻搗椋炰笉涔呴伃閬囬棯鐢碉紝鍦ㄧ┖涓紑濮嬭В浣撳茍涓澶村啿鍚戝湴闈€傛湵涓藉畨濞滃彂鐜拌嚜宸變竴鐩磋鎹嗗湪搴ф涓婏紝涓嬭惤灝嗚繎</span><span style="font-size: 12pt;">2</span><span style="font-family: DengXian; font-size: 12pt;">鑻遍噷鏈緇堣惤鍏ョ椴佺儹甯﹂洦鏋椼?/span></p> <p><span style="font-family: DengXian; font-size: 12pt;">鍦ㄦ湵涓藉畨濞滅鏅厠鐨勬嬈′簨浠朵笂錛屼笓瀹舵寚鍑虹敱浜庡湪涓嬮檷涓ス琚畨鏀懼埌搴ф涓婃墠瀵艱嚧濂規椿浜嗕笅鏉ワ紝鍙槸鏂簡閿侀鑰屽凡銆傚ス鏄鑸彮鐨勫敮涓騫稿瓨鑰咃紝欏虹潃婧祦鍦ㄩ洦鏋楅噷鐢熸椿浜?/span><span style="font-size: 12pt;">11</span><span style="font-family: DengXian; font-size: 12pt;">澶┿?/span></p> <p><span style="font-family: DengXian; font-size: 12pt;">鍦ㄥス閱掕繃鏉ュ悗涓涙灄閲岀殑鏄嗚櫕涓嶅啀鍙挰濂癸紝鍙槸铔嗗凡緇忔劅鏌撲簡濂圭殑鑳寵唺錛?/span><span style="font-size: 12pt;">9</span><span style="font-family: DengXian; font-size: 12pt;">澶╁悗錛屽ス鎵懼埌浜嗕竴澶勯湶钀ュ湴銆傚湪姝わ紝濂圭粰鑷繁榪涜浜嗗垵綰ф不鐤楋紝渚嬪鐢ㄦ苯娌規祰鍒拌泦鎰熸煋鐨勯儴浣嶃傝泦瀹蟲曟苯娌瑰氨紱誨紑浜嗕激鍙c傚嚑涓皬鏃跺欏悗錛岃繍鏈ㄥ伐浜哄彂鐜頒簡濂癸紝緇欎笌鍩烘湰鍖葷枟騫舵妸濂瑰甫鍒版洿瀹滃眳鐨勫尯鍩燂紝鐒跺悗濂硅絀鴻繍鍒板尰闄€?/span></p> <p><span style="font-family: DengXian; font-size: 12pt;">浼ゅ彛鎭㈠鍚庯紝鏈變附瀹夊甯姪鎼滄晳闃熷畾浣嶅け浜嬪湴鐐瑰拰鎼滄晳姝婚毦鑰呭案浣撱傚ス濡堝鐨勫案浣撲簬</span><span style="font-size: 12pt;">1972</span><span style="font-family: DengXian; font-size: 12pt;">騫?/span><span style="font-size: 12pt;">1</span><span style="font-family: DengXian; font-size: 12pt;">鏈?/span><span style="font-size: 12pt;">12</span><span style="font-family: DengXian; font-size: 12pt;">鏃ヨ鍙戠幇銆傛湵涓藉畨濞滃洖鍒板痙鍥藉悗浼ゅ彛瀹屽叏鎭㈠浜嗘甯搞傝窡鐖舵瘝綾諱技錛屾湵涓藉畨濞滆幏寰楃敓鐗╁瀛︿綅鍚庤繑鍥炵椴佺戶緇繁鍏ョ爺絀惰潤铦犮傚ス鐨勫弻閲嶇敓瀛樻晠浜嬫垚浜嗕功鍜岀數褰辯殑涓諱綋錛屽叾涓寘鎷簡濂圭殑鑷紶鍜屼粬浼狅紝“褰撴垜浠庡ぉ鑰岄檷”錛屼互鍙婂婕旀矁綰寵但灝斾綈鏍肩殑綰綍鐗?#8220;緲呰唨涓婄殑甯屾湜”銆備粬</span><span style="font-size: 12pt;">(</span><span style="font-family: DengXian; font-size: 12pt;">娌冪撼璧皵浣愭牸</span><span style="font-size: 12pt;">)</span><span style="font-family: DengXian; font-size: 12pt;">鍦?/span><span style="font-size: 12pt;">1971</span><span style="font-family: DengXian; font-size: 12pt;">騫翠篃棰勫畾浜嗗ス</span><span style="font-size: 12pt;">(</span><span style="font-family: DengXian; font-size: 12pt;">鏈變附瀹夊</span><span style="font-size: 12pt;">)</span><span style="font-family: DengXian; font-size: 12pt;">鐨勯偅嬈¤埅鐝紝椋炴満璧烽鍓嶆渶鍚庝竴鍒嗛挓鏀瑰彉璁″垝錛屼粠鑰岃翰榪囦竴鍔?br /><br /></span></p> <p><strong><span style="font-family: DengXian; font-size: 12pt;">浜嬪悗</span></strong></p> <p><span style="font-family: DengXian; font-size: 12pt;">鏈變附瀹夊鐨勪莖騫稿瓨媧繪垚浜嗗悇縐嶇瀻鐚滄帹鏂殑涓婚銆?寰堟槑鏄懼ス琚畨鍏ㄥ甫鎹嗗湪搴ф涓婃湁浜嗘煇縐嶇▼搴︾殑鐩劇墝鍜岀紦鍐詫紝鑰屼笖鐞嗚涓婂鍥存暣鎺掔殑搴ф錛屽氨鏄湵涓藉畨濞滀袱杈圭殑閭d簺錛岃搗鍒頒簡闄嶈惤浼炵殑浣滅敤錛屽噺緙撲簡濂逛笅钀界殑閫熷害..."銆?#8220;椋庢毚婕傜Щ浠ュ強钀藉湴鐐瑰帤鍘氱殑鏋濆彾鍙互榪涗竴姝ラ檷浣庨噷鍐插嚮鍔?..”銆?/span></p> <p><span style="font-family: DengXian; font-size: 12pt;">鏈變附瀹夊鍥炲埌寰峰浗褰誨簳搴峰榪囨潵錛岃蛋浜嗙埗姣嶄竴鏍風殑璺紝鍦ㄥ熀灝斿ぇ瀛﹀涔犵敓鐗╋紝</span><span style="font-size: 12pt;">1980</span><span style="font-family: DengXian; font-size: 12pt;">騫存瘯涓氥傚湪鎱曞凹榛戦害鍏嬭タ綾沖叞澶у鑾峰緱鍗氬+瀛︿綅鍚庤繑鍥炲埌縐橀瞾灞曞紑鍝轟鉤鍔ㄧ墿鐮旂┒錛屼笓娉ㄤ簬铦欒潬錛屽湪</span><span style="font-size: 12pt;">1987</span><span style="font-family: DengXian; font-size: 12pt;">騫村彂琛ㄨ鏂囷紝“縐橀瞾鐑甫闆ㄦ灄閲屼竴涓潤铦犵敓鐗╃帇鍥界殑鐮旂┒”銆?/span><span style="font-size: 12pt;">1989</span><span style="font-family: DengXian; font-size: 12pt;">騫存湵鑾夊畨濞滅鏅厠鍜屼竴涓笓娉ㄤ簬鐮旂┒瀵勭敓榛勮渹鐨勬槅铏瀹惰壘鍔涘厠榪媺緇撳銆?/span><span style="font-size: 12pt;">2000</span><span style="font-family: DengXian; font-size: 12pt;">騫存湵涓藉畨濞滄帴綆′簡娼樺彜閭e綋涓婁簡涓諱換錛岀埗浜插幓涓栦簡銆?/span></p> <p><span style="font-family: DengXian; font-size: 12pt;">鐜板湪鏈變附瀹夊榪媺鍦ㄦ厱灝奸粦宸翠紣鍒╀簹鍔ㄧ墿瀛﹁拹钘忕爺絀朵腑蹇冨綋綆$悊鍛樸傚ス鐨勮嚜浼犲拰浠栦紶”褰撴垜浠庡ぉ鑰岄檷”</span><span style="font-size: 12pt;">(</span><span style="font-family: DengXian; font-size: 12pt;">寰瘋</span><span style="font-size: 12pt;">: Als ich vom Himmel fie)</span><span style="font-family: DengXian; font-size: 12pt;">浜?/span><span style="font-size: 12pt;">2011</span><span style="font-family: DengXian; font-size: 12pt;">騫?/span><span style="font-size: 12pt;">3</span><span style="font-family: DengXian; font-size: 12pt;">鏈?/span><span style="font-size: 12pt;">10</span><span style="font-family: DengXian; font-size: 12pt;">鏃ョ敱媧劇弨鏋楁牸鍑虹増錛屼負姝ゅス鑾峰緱浜?/span><span style="font-size: 12pt;">2011</span><span style="font-family: DengXian; font-size: 12pt;">鏌惓鏂囧濂栥?/span><span style="font-size: 12pt;">2019</span><span style="font-family: DengXian; font-size: 12pt;">騫寸椴佹斂搴滄巿浜堝ス楂樼駭鍐涘畼鐨勬澃鍑烘湇鍔″銆?br /></span></p><img src ="http://m.shnenglu.com/Chipset/aggbug/217779.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/Chipset/" target="_blank">灞卞縐戞妧</a> 2021-08-13 21:17 <a href="http://m.shnenglu.com/Chipset/archive/2021/08/13/217779.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>What does 鈥渟tride鈥?mean in image processing? [fwd]http://m.shnenglu.com/Chipset/archive/2021/07/12/217739.html灞卞縐戞妧灞卞縐戞妧Mon, 12 Jul 2021 07:00:00 GMThttp://m.shnenglu.com/Chipset/archive/2021/07/12/217739.htmlhttp://m.shnenglu.com/Chipset/comments/217739.htmlhttp://m.shnenglu.com/Chipset/archive/2021/07/12/217739.html#Feedback0http://m.shnenglu.com/Chipset/comments/commentRss/217739.htmlhttp://m.shnenglu.com/Chipset/services/trackbacks/217739.htmlhttps://medium.com/@oleg.shipitko/what-does-stride-mean-in-image-processing-bba158a72bcd

Stride is an important concept in digital image processing. It allows performing several operations with an image in a very fast manner (in constant time) by simple modification of image metadata. If you are interested in finding out what stride is and how to use it stick with us.

Pixel representation in a computer memory

Before we dive into the concept of stride we first need to revise how digital images are stored in a computer memory. We will start from a pixel.

An image pixel is represented in a computer memory by a fixed number of bits. Typical pixel bit depth (amount of bits per pixel) is 32, 16, 8 or, for binary images, 1 bit. In typical RGB images, 8 bits are often used to store the color value ​​of a single channel. Thus, the total bit depth of one pixel is 24. Processing 32 and 16-bit chunks of data is simple and effective on a typical 32 and 64-bit processors. Therefore, the pixels are stored in the format of 32 bits, where the older (or younger, depending on the implementation) 8 bits remain unused. Such an approach to storing pixels requires more memory, but it allows speeding up image processing by using the standard size of the machine word. Thus, a standard RGB image occupies 32 bits in memory and has a depth of 24 bits. We will call another 8 bits necessary to supplement the size of the memory occupied by a pixel to the value of a multiple of degree 2, pixel padding. The total number of bytes occupied by a pixel in memory is called pixel stride (See Image 1).

Image representation in a computer memory

Images are stored in computer memory pixel-by-pixel, line by line. The upper left corner of the image is usually chosen as a coordinate origin (the upper left pixel of the image has the index [0, 0]). The image is stored in memory as a one-dimensional array. Pixels of the first line of the image are first written to the memory, then pixels of the second line and so on up to the last line. Each line in addition to the pixel bytes may also contain additional bytes — line padding. Additional bytes usually do not contain useful information and do not affect the visualization of an image when, for example, displayed on the screen. These additional bytes serve to complement a line, which is necessary for more efficient image processing and is caused by the specificity of the hardware used. For example, Cairo (a popular open source vector graphics software library) requires alignment of rows to multiple 4 bytes, which allows for more efficient image processing algorithms using vectorized processor operations and processing several image pixels simultaneously.

Introducing the term of line padding requires to introduce another closely coupled term — line stride.

Line stride (incrementpitch or step size) is the number of bytes that one needs to add to the address in the first pixel of a row in order to go to the address of the first pixel of the next row. It is important to note that an image width is measured in pixels and describes an image itself (and doesn’t depend on how an image is stored in a computer memory). In contrast, a line stride depends on how an image is represented in memory and is measured in bytes.

In program source code, an image is usually represented by a data structure containing metadata (image width and heightline stridenumber of channelsencoding type, etc.), as well as a pointer to the address of the first image pixel in memory (further we will refer to this address as data_begin). This information allows us to unambiguously read and decode an image from memory, as well as to perform a series of fast image operations by changing only a metadata associated with an image.


An image representation in a computer memory. Lines of an image are stored one by one in one-dimensional array.

Image operations:
Let’s summarize all the terms which we introduced to this moment:
pixel_address — a pixel address in memory
pixel depth —the number of bits per pixel (containing valuable information)
pixel_stride — the number of bytes occupied in memory by a pixel of an image
data_begin — the address of the first image pixel in memory
channels — the number of image channels (3 for an RGB-image)
channel_address — the address of a particular pixel channel in memory
height — the image height in pixels
width — the image width in pixels
line_stride — the number of bytes occupied in memory by a line of an image

Operations:

1.       Computing pixel address in memory

The equation relating pixel memory address to its coordinates [y, x] in the image coordinate system can be represented as:

pixel_address = data_begin + y * line_stride + x * pixel_stride, (1)
where data_begin — the address of the first image pixel in memory.

Equation (1) is used whenever you access an image in memory. In the rest of operations, presented in this post, we will only change a metadata associated with an image and assume, that the equation (1) is applied after in order to access image.

2. Pixel decoding (for RGB image with an equal amount of bits per channel):

channel_address = pixel_address + n * depth / channels, (2)
where is a channel index: n = 0, 1, …, channels — 1. Thus, for instance, for the typical RGB-image with an equal amount of bits per channel, a channel address in memory can be computed as follows:
R = pixel_address,
G = pixel_address + depth / channels,
B = pixel_address + 2 * depth / channels.

It is important to note that these equations depend on the type of the image stored. There are formats in which different number of bytes is used to store different channels.

3. Image flip

3.1 Vertical flip
data_begin = data_begin + (height- 1) * line_stride ,
line_stride = -line_stride.


Pointer to the first image pixel for the vertical flip

The negative line stride being inserted into equation (1) allows us to move upwards reading (or visualizing) an image from the last row to the first, thus, realizing vertical flip.

3.2 Horizontal flip
data_begin = data_begin + (width — 1) * pixel_stride ,
pixel_stride = -pixel_stride.


Pointer to the first image pixel for the horizontal flip

In the same manner as with negative line stride in the previous example, the negative pixel stride here allows us to move from right to left and to read (or visualize) an image flipped horizontally.

3.3 Vertical and horizontal flip
The combination of previous two approaches allows to flip an image in both directions at once:
data_begin = data_begin + (height-1) * line_stride + (width-1) * pixel_stride,
line_stride = -line_stride,
pixel_stride = -pixel_stride.

 
Pointer to the first image pixel for the simultaneous vertical and horizontal flip

4. Extracting image subwindow
data_begin = new_data_begin,
width = new_width,
height = new_height.
With this approach we set a new origin of our image (inside a boundary of the original image) and set a width and height which basically tell us how many time we should apply an equation (1) to read all pixels (width x height) and after which amount of pixels read we should increase the y coordinate (to start reading pixels of the next row). Note that such parameters as line stride remain unchanged.

5. Extracting single image channel
To extract a single image channel we can use a combination of equations (1) and (2):
pixel_address = data_begin + y * line_stride + x * pixel_stride + n * depth / channels,
where n — channel index, n = 0, 1, …, channels — 1.

REFERENCES
1.       A programmer’s view on digital images: the essentials: https://www.collabora.com/news-and-blog/blog/2016/02/16/a-programmers-view-on-digital-images-the-essentials/
2.      Microsoft Media Foundation Programming Guide: Image Stride:Image Stride When a video image is stored in memory, the memory buffer might contain extra padding bytes after each row of pixels…docs.microsoft.com
3.      Wikipedia: Stride of an array: https://en.wikipedia.org/wiki/Stride_of_an_array
4.      Cairo library: https://cairographics.org/



]]>
raster and vector image [fwd]http://m.shnenglu.com/Chipset/archive/2021/07/09/217733.html灞卞縐戞妧灞卞縐戞妧Fri, 09 Jul 2021 12:13:00 GMThttp://m.shnenglu.com/Chipset/archive/2021/07/09/217733.htmlhttp://m.shnenglu.com/Chipset/comments/217733.htmlhttp://m.shnenglu.com/Chipset/archive/2021/07/09/217733.html#Feedback0http://m.shnenglu.com/Chipset/comments/commentRss/217733.htmlhttp://m.shnenglu.com/Chipset/services/trackbacks/217733.html杞澆鐨勶紝鍑哄涓嶈銆?br />
Raster Images
 
Raster (or bitmap) images are generally what you think about when thinking of images. These are the types of images that are produced when scanning or photographing an object. Raster images are compiled using pixels, or tiny dots, containing unique color and tonal information that come together to create the image. 
Since raster images are pixel based, they are resolution dependent. The number of pixels that make up an image as well as how many of those pixels are displayed per inch, both determine the quality of an image. As you may have guessed, the more pixels in the image and the higher the resolution is, the higher quality the image will be.
For example, if we scale a raster image to enlarge it, without changing resolution, it will lose quality and look blurry or pixilated. This is because we are stretching the pixels over a larger area, thus making them look less sharp. This is a common problem but can be remedied by using raster image editing programs such as Photoshop to change resolution and properly scale images.
 
Common Raster Image Types: JPG, TIFF, GIF, PNG, BMP
 

Vector Images
 
Instead of trying to keep track of the millions of tiny pixels in a raster image, vector images, or line art, keep track of points and the equations for the lines that connect them. Generally speaking, vector images are made up of paths or line art that can infinitely scalable because they work based on algorithms rather than pixels.
 
One of the greatest things about vector images is that you can re-size them infinitely larger or smaller, and they will still print out just as clearly, with no increase (or decrease) in file size. If you remember back to your high school geometry, the equation for a circle of center (h,k) and radius r is (x - h)2 + (y - k)2 = r2. If you want to make the circle bigger, you just increase the value of r - instead of having to keep track of tons more pixels, the computer just has to keep track of a different number. That takes almost no file space at all.
So, what types of graphics would typically be vector? Well, almost all computer font files are based on vector images of the letters - that's why it's possible to scale them WAY up or WAY down and still have the letters be clear.  All Microsoft Office clipart uses vector art and most charts and graphs produced by Office or by statistical analysis software are vector-based. Typically vector art is created in illustration applications such as Adobe Illustrator or CorelDRAW. Vector illustrations are great for logos, illustrations/artwork, animations, and text. 
Common Vector File Types: EPS, SVG


]]>
Base64http://m.shnenglu.com/Chipset/archive/2021/06/22/217717.html灞卞縐戞妧灞卞縐戞妧Tue, 22 Jun 2021 09:54:00 GMThttp://m.shnenglu.com/Chipset/archive/2021/06/22/217717.htmlhttp://m.shnenglu.com/Chipset/comments/217717.htmlhttp://m.shnenglu.com/Chipset/archive/2021/06/22/217717.html#Feedback0http://m.shnenglu.com/Chipset/comments/commentRss/217717.htmlhttp://m.shnenglu.com/Chipset/services/trackbacks/217717.html/*   base64.cpp and base64.h...  闃呰鍏ㄦ枃

]]>
鐣欏鍔犳嬁澶?/title><link>http://m.shnenglu.com/Chipset/archive/2020/07/06/217394.html</link><dc:creator>灞卞縐戞妧</dc:creator><author>灞卞縐戞妧</author><pubDate>Mon, 06 Jul 2020 01:49:00 GMT</pubDate><guid>http://m.shnenglu.com/Chipset/archive/2020/07/06/217394.html</guid><wfw:comment>http://m.shnenglu.com/Chipset/comments/217394.html</wfw:comment><comments>http://m.shnenglu.com/Chipset/archive/2020/07/06/217394.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.shnenglu.com/Chipset/comments/commentRss/217394.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/Chipset/services/trackbacks/217394.html</trackback:ping><description><![CDATA[     鎽樿: 杞嚜鐭ヤ箮錛屼笉瀵圭湡瀹炴ц礋璐c傚熀鏈熀浜庣幇瀹炵敓媧伙紝緇嗚妭鏈夊姞宸ャ傚師鍏堝啓榪欎釜絳旀錛屽彧鏄兂璋冧緝涓涓嬪綋騫存垜鑷繁鍜屽懆鍥村悓瀛︿滑鐣欏浠ュ強涔嬪悗縐繪皯鐨勭粡鍘嗭紝鍥犱負鎯崇潃浠ヨ嫳鏂囧瓧姣嶄唬鏇跨湡瀹炰漢鍚嶏紝鎵浠ュ彧鍐欎簡涓嶅埌26涓佸悓瀛︾殑灝忔晠浜嬶紝浣嗗啓瀹屽悗鍙戠幇澶亸棰囷紝閮芥槸灝忕暀瀛︾敓杞Щ姘戠殑妗堜緥錛屼笉瓚充互浠h〃騫垮ぇ鎴愬勾宸ヤ綔鍚庡啀鏉ュ埌鍔犳嬁澶х殑鎶鏈Щ姘戯紝鎶曡祫縐繪皯錛岀敋鑷崇伆鑹蹭竴鐐圭殑錛岄毦姘戯紝鍋鋒浮瀹紝鎵浠ヨˉ鍏呬簡涓浜涙晠浜嬨備絾榪欐牱涓鏉ュ瓧姣嶅氨涓嶅鐢ㄤ簡錛屾垜灝辯敤浠栦滑鐨勫鍙鋒垨鑰?..  <a href='http://m.shnenglu.com/Chipset/archive/2020/07/06/217394.html'>闃呰鍏ㄦ枃</a><img src ="http://m.shnenglu.com/Chipset/aggbug/217394.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/Chipset/" target="_blank">灞卞縐戞妧</a> 2020-07-06 09:49 <a href="http://m.shnenglu.com/Chipset/archive/2020/07/06/217394.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>PDF閲岀殑BOXhttp://m.shnenglu.com/Chipset/archive/2020/03/02/217178.html灞卞縐戞妧灞卞縐戞妧Mon, 02 Mar 2020 09:01:00 GMThttp://m.shnenglu.com/Chipset/archive/2020/03/02/217178.htmlhttp://m.shnenglu.com/Chipset/comments/217178.htmlhttp://m.shnenglu.com/Chipset/archive/2020/03/02/217178.html#Feedback0http://m.shnenglu.com/Chipset/comments/commentRss/217178.htmlhttp://m.shnenglu.com/Chipset/services/trackbacks/217178.htmlThe PDF page boxes: MediaBox, CropBox, BleedBox, TrimBox & ArtBox

A PDF describes the content and appearance of one or more pages. It also contains a definition of the physical size of those pages. That page size definition is not as straightforward as you might think. There can in fact be up to 5 different definitions in a PDF that relate to the size of its pages. These are called the boundary boxes or page boxes:

·         The MediaBox is used to specify the width and height of the page. For the average user, this probably equals the actual page size. For prepress use, this is not the case as we prefer our pages to be defined slightly oversized so that we can see the bleed (Images or other elements touching an outer edge of a printed page need to extend beyond the edge of the paper to compensate for inaccuracies in trimming the page), the crop marks and useful information such as the file name or the date and time when the file was created. This means that PDF files used in graphic arts usually have a MediaBox which is larger than the trimmed page size.

·         The CropBox defines the region that the PDF viewer application is expected to display or print. So if a PDF contains a CropBox definition, Acrobat uses it for screen display and printing. For prepress use, the CropBox is pretty irrelevant. The GWG industry association recommends not to use it at all.

·         The TrimBox defines the intended dimensions of the finished page. Contrary to the CropBox, the TrimBox is very important because it defines the actual page size that gets printed. The imposition programs and workflows that I know all use the TrimBox as the basis for positioning pages on a press sheet. By default the TrimBox equals the CropBox.

·         The BleedBox determines the region to which the page contents needs to be clipped when output in a production environment. Usually the BleedBox is 3 to 5 millimeters larger than the TrimBox. It is nice to know the size of the BleedBox but it isn’t that important in graphic arts. Most prepress systems allow you to define the amount of bleed yourself and ignore the BleedBox. By default the BleedBox equals the CropBox.

·         The ArtBox is a bit of a special case. It was originally added to indicate the area covered by the artwork of the page. It is never used for that but can be handy in a few cases:

·         On a PDF page that contains an advertisement, the ArtBox can be used to define the location of that ad. This allows you to place that PDF on another page but only use the area covered by the advert.

·         A more common use of the ArtBox is as a means to indicate the safety zone. When creating a poster that will be placed in a lightbox, the designer must make sure text and logo’s aren’t positioned too close to the edge. If the poster is not mounted properly, this could cause that text or logo to disappear behind the frame of the lightbox. In book design, there is also a margin where you cannot put text because the binding might make it difficult to read text that is too close to the spine. The area where it is safe to place graphic elements is called the safety zone or text safe area. The ArtBox can be used to indicate the dimensions of this part of the page.


General rules regarding page boxes

·         Each page in a PDF can have different sizes for the various page boxes.

·         The page boxes are always rectangular. That may seem logical but artwork is not always rectangular: a PDF can represent an oval label or the foldout of a cardboard box.

·         A PDF always has a MediaBox definition. All the other page boxes do not necessarily have to be present in regular PDF files.

·         The above rule is not true for the PDF/X file formats:

·         PDF/X-1a and PDF/X-3 compliant files need to include the MediaBox, TrimBox, and BleedBox.

·         PDF/X-4 files need, next to the MediaBox, a TrimBox or an ArtBox, but not both. The ArtBox or TrimBox cannot be larger that the BleedBox. If a CropBox is present, the ArtBox,  TrimBox, and BleedBox need to extend beyond its boundaries.

·         The MediaBox is the largest page box in a PDF. The other page boxes can equal the size of the MediaBox but they are not expected to be larger (The latter is explicitly required in the PDF/X-4 requirements). If they are larger, the PDF viewer will use the values of the MediaBox.

BBox

Within PDF files there is another box, the bounding box or BBox, that is used. The bounding box is a rectangular frame that determines the dimensions of an object (such as a graphic, font or pattern) that is placed inside a PDF document. As such, this box has nothing to do with the page boxes.



]]>
緙栬瘧鍣ㄩ瀹氫箟鐨勫畯http://m.shnenglu.com/Chipset/archive/2016/10/26/214357.html灞卞縐戞妧灞卞縐戞妧Wed, 26 Oct 2016 01:01:00 GMThttp://m.shnenglu.com/Chipset/archive/2016/10/26/214357.htmlhttp://m.shnenglu.com/Chipset/comments/214357.htmlhttp://m.shnenglu.com/Chipset/archive/2016/10/26/214357.html#Feedback0http://m.shnenglu.com/Chipset/comments/commentRss/214357.htmlhttp://m.shnenglu.com/Chipset/services/trackbacks/214357.html
婧愯嚜錛歨ttps://sourceforge.net/p/predef/wiki/Architectures/

Architectures

Please send updates/corrections to predef-contribute.

Alpha

Type Macro Description
Identification __alpha__ Defined by GNU C
Version __alpha_ev'V'__ V = Version
Identification __alpha Defined by DEC C
Identification _M_ALPHA Defined by Visual Studio
Example
CPU Macro
Alpha EV4 __alpha_ev4__
Alpha EV5 __alpha_ev5__
Alpha EV6 __alpha_ev6__

AMD64

Type Macro Description
Identification __amd64__
__amd64
__x86_64__
__x86_64
Defined by GNU C and Sun Studio
Identification _M_X64
_M_AMD64
Defined by Visual Studio

Notice that x32 can be detected by checking if the CPU uses the ILP32 data model.

ARM

Type Macro Description
Identification __arm__ Defined by GNU C and RealView
Identification __thumb__ Defined by GNU C and RealView in Thumb mode
Version __ARM_ARCH_'V'__ V = Version

Defined by GNU C 1
Identification __TARGET_ARCH_ARM
__TARGET_ARCH_THUMB
Defined by RealView
Version __TARGET_ARCH_ARM = V
__TARGET_ARCH_THUMB = V
V = Version
Version __TARGET_ARCH_'VR' VR = Version and Revision
Identification _ARM Defined by ImageCraft C
Identification _M_ARM Defined by Visual Studio
Identification _M_ARMT Defined by Visual Studio in Thumb mode
Version _M_ARM = V V = Version
Identification __arm Defined by Diab
Example
CPU Macro _M_ARM
ARM 2 __ARM_ARCH_2__
ARM 3 __ARM_ARCH_3__
__ARM_ARCH_3M__

ARM 4T __ARM_ARCH_4T__
__TARGET_ARM_4T

ARM 5 __ARM_ARCH_5__
__ARM_ARCH_5E__
5
ARM 5T __ARM_ARCH_5T__
__ARM_ARCH_5TE__
__ARM_ARCH_5TEJ__

ARM 6 __ARM_ARCH_6__
__ARM_ARCH_6J__
__ARM_ARCH_6K__
__ARM_ARCH_6Z__
__ARM_ARCH_6ZK__
6
ARM 6T2 __ARM_ARCH_6T2__
ARM 7 __ARM_ARCH_7__
__ARM_ARCH_7A__
__ARM_ARCH_7R__
__ARM_ARCH_7M__
__ARM_ARCH_7S__
7

ARM64

Type Macro Description
Identification __aarch64__ Defined by GNU C 1

Blackfin

Type Macro Description
Identification __bfin
__BFIN__
Defined by GNU C

Convex

Type Macro Description
Identification __convex__ Defined by GNU C
Version __convex_'V'__ V = Version
Example
CPU Macro
Convex C1 __convex_c1__
Convex C2 __convex_c2__
Convex C32xx series __convex_c32__
Convex C34xx series __convex_c34__
Convex C38xx series __convex_c38__

Epiphany

Type Macro
Identification __epiphany__

HP/PA RISC

Type Macro Description
Identification __hppa__ Defined by GNU C
Identification __HPPA__ Defined by Stratus VOS C
Identification __hppa
Version _PA_RISC'V'_'R' V = Version
R = Revision

See also OpenPA.net.

Example
CPU Macro
PA RISC 1.0 _PA_RISC1_0
PA RISC 1.1 _PA_RISC1_1
__HPPA11__
__PA7100__
PA RISC 2.0 _PA_RISC2_0
__RISC2_0__
__HPPA20__
__PA8000__

Intel x86

Type Macro Format Description
Identification i386
__i386
__i386__

Defined by GNU C
Version __i386__
__i486__
__i586__
__i686__

Defined by GNU C
Identification __i386
Defined by Sun Studio
Identification __i386
__IA32__

Defined by Stratus VOS C
Identification _M_I86
Only defined for 16-bits architectures

Defined by Visual Studio, Digital Mars, and Watcom C/C++ (see note below)
Identification _M_IX86
Only defined for 32-bits architectures

Defined by Visual Studio, Intel C/C++, Digital Mars, and Watcom C/C++
Version _M_IX86 V00 V = Version
Identification __X86__
Defined by Watcom C/C++
Identification _X86_
Defined by MinGW32
Identification __THW_INTEL__
Defined by XL C/C++
Identification __I86__
Defined by Digital Mars
Version __I86__ V V = Version
Identification __INTEL__
Defined by CodeWarrior
Identification __386
Defined by Diab

Notice that Watcom C/C++ defines _M_IX86 for both 16-bits and 32-bits architectures. Use __386__ or _M_I386 to detect 32-bits architectures in this case.

Notice that the Stratus VOS is big-endian on IA32, so these macros cannot be used to detect endianness if __VOS__ is set.

Example
CPU _M_IX86 __I86__
80386 300 3
80486 400 4
Pentium 500 5
Pentium Pro/II 600 6

Intel Itanium (IA-64)

Type Macro Format Description
Identification __ia64__
_IA64
__IA64__

Defined by GNU C
Identification __ia64
Defined by HP aCC
Identification _M_IA64
Defined by Visual Studio
Identification _M_IA64
Defined by Intel C/C++
Version _M_IA64 ?
Identification __itanium__
Defined by Intel C/C++
Example
CPU _M_IA64 (Intel C/C++)

64100

Motorola 68k

Type Macro Description
Identification __m68k__ Defined by GNU C
Version __mc'V'__
__mc'V'
mc'V'
V = Version
Identification M68000 Defined by SAS/C
Identification __MC68K__ Defined by Stratus VOS C
Version __MC'V'__ V = Version
Example
CPU Macro
68000 __mc68000__
__MC68000__
68010 __mc68010__
68020 __mc68020__
__MC68020__
68030 __mc68030__
__MC68030__
68040 __mc68040__
68060 __mc68060__

MIPS

Type Macro Description
Identification __mips__
mips
Defined by GNU C
Version _MIPS_ISA = _MIPS_ISA_MIPS'V' V = MIPS ISA level
Version _R3000
_R4000
_R5900

Identification __mips Defined by MIPSpro and GNU C
Version __mips The value indicates the MIPS ISA (Instruction Set Architecture) level
Version __MIPS_ISA'V'__ V = MIPS ISA level
Identification __MIPS__ Defined by Metrowerks
Example
CPU _MIPS_ISA GNU C Macro __mips MIPSpro Macro
R2000 _MIPS_ISA_MIPS1
1
R3000 _MIPS_ISA_MIPS1 _R3000 1
R6000 _MIPS_ISA_MIPS2
2 __MIPS_ISA2__
R4000
_R4000

R4400 _MIPS_ISA_MIPS3
3 __MIPS_ISA3__
R8000 _MIPS_ISA_MIPS4
4 __MIPS_ISA4__
R10000 _MIPS_ISA_MIPS4
4 __MIPS_ISA4__

PowerPC

Type Macro Description
Identification __powerpc
__powerpc__
__powerpc64__
__POWERPC__
__ppc__
__ppc64__
__PPC__
__PPC64__
_ARCH_PPC
_ARCH_PPC64
Defined by GNU C
Version __ppc'V'__ V = Version
Identification _M_PPC Defined by Visual Studio
Version _M_PPC ?
Identification _ARCH_PPC
_ARCH_PPC64
Defined by XL C/C++
Version _ARCH_'V' V = Version
Version __PPCGECKO__ Gekko

Defined by CodeWarrior
Version __PPCBROADWAY__ Broadway

Defined by CodeWarrior
Version _XENON Xenon
Identification __ppc Defined by Diab
Example
CPU _M_PPC Macro XL Macro
PowerPC 440

_ARCH_440
PowerPC 450

_ARCH_450
PowerPC 601 601 __ppc601__ _ARCH_601
PowerPC 603 603 __ppc603__ _ARCH_603
PowerPC 604 604 __ppc604__ _ARCH_604
PowerPC 620 620

Pyramid 9810

Type Macro
Identification pyr

RS/6000

Type Macro Description
Identification __THW_RS6000 Defined by XL C/C++
Identification _IBMR2
Identification _POWER
Identification _ARCH_PWR
_ARCH_PWR2
_ARCH_PWR3
_ARCH_PWR4

SPARC

Type Macro Description
Identification __sparc__ Defined by GNU C
Identification __sparc Defined by Sun Studio
Version __sparc_v8__
__sparc_v9__
Defined by GNU C
Version __sparcv8
__sparcv9
Defined by Sun Studio
Example
CPU Sun Studio Macro GNU C Macro
SPARC v8 (SuperSPARC) __sparcv8 __sparc_v8__
SPARC v9 (UltraSPARC) __sparcv9 __sparc_v9__

SuperH

Type Macro Description
Identification __sh__ Defined by GNU C
Version __sh1__
__sh2__
__sh3__
__SH3__
__SH4__
__SH5__

SystemZ

Type Macro Description
Identification __370__
__THW_370__
Identifies System/370

Defined by XL C/C++
Identification __s390__ Identifies System/390

Defined by GNU C
Identification __s390x__ Identifies z/Architecture

Defined by GNU C
Identification __zarch__ Identifies z/Architecture

Defined by clang
Identification __SYSC_ZARCH__ Identifies z/Architecture

Defined by Systems/C

TMS320

Type Macro Description
Identification _TMS320C2XX
__TMS320C2000__
C2000 series
Identification _TMS320C5X
__TMS320C55X__
C5000 series
Identification _TMS320C6X
__TMS320C6X__
C6000 series
Example
DSP Macro
C28xx _TMS320C28X
C54x _TMS320C5XX
C55x __TMS320C55X__
C6200 _TMS320C6200
C6400 _TMS320C6400
C6400+ _TMS320C6400_PLUS
C6600 _TMS320C6600
C6700 _TMS320C6700
C6700+ _TMS320C6700_PLUS
C6740 _TMS320C6740

TMS470

Type Macro
Identification __TMS470__


]]>
When someone gives you a bug [FWD]http://m.shnenglu.com/Chipset/archive/2015/04/01/210219.html灞卞縐戞妧灞卞縐戞妧Wed, 01 Apr 2015 06:39:00 GMThttp://m.shnenglu.com/Chipset/archive/2015/04/01/210219.htmlhttp://m.shnenglu.com/Chipset/comments/210219.htmlhttp://m.shnenglu.com/Chipset/archive/2015/04/01/210219.html#Feedback0http://m.shnenglu.com/Chipset/comments/commentRss/210219.htmlhttp://m.shnenglu.com/Chipset/services/trackbacks/210219.html
Someone gives you a bug. "The light in the conference room on the 26th floor is on. It needs to be off."

A note on the bug says, “This will take you like 5 minutes. It's just flipping a switch."

You go to the conference room on 26. The light is on, but there's no light switch in the room.

So you prepare to install one. But the designer says it would ruin the room’s aesthetic. Plus, the walls are concrete. With the proper tools, you could install the switch. But no one will approve the purchase of the proper tools. Without the proper tools it will take two days. And they want it done now, because they're afraid that any minute the CEO might decide to go to the 26th floor and happen to walk by the conference room and ask why the hell that light is on.

And now you're getting emails asking why the light isn't off yet.

So now you have to stop and send a group email to explain the situation, and several people start up a panicked email chain.

You know if you wait for the problem to be resolved by anyone discussing it in the email chain, it won’t get fixed. The bug has your name on it, and it's dated today, so you're the one in trouble if it isn't resolved. So you go up into the hallway ceiling on 26, find the wires leading to the light, cut and cap them. Finally. Problem solved.

In order to quell the panic in the email thread, you report back how you solved the issue.

You don’t hear anything for a while. When you do, everyone is concerned that now the light can’t be turned on and off. What if the CEO wants to have a meeting in there? So here’s what they ask you to do: They want you to run wires from the light down into the basement. When someone needs the light to be on or off, they’ll contact you, and have you run to the basement and either connect or disconnect the wires.

You protest the ridiculousness of this solution. Your boss says, “Yeah, I know it’s not ideal. But it’s the only solution we have right now."

At this point you realize you have a choice. You could do this. Or you could quit in protest, and find another job. But you realize that once you start that new job, they’re likely to ask you to do something just as idiotic, if not more so.

So you go run the wires from floor 26 down to the basement. When you get to the basement, you see dozens of wires hanging out of the walls, from all the people who have had to do this exact same thing before. (So that’s where the idea came from.) You set up the wires and label them as best you can, with a short apology to whoever has to deal with this next.

When you get back to your desk, you have a message. QA has reopened the bug. It says, “I see light."

You head back up to the conference room on 26. The light is off. You go back to your desk and close the bug, reporting that you checked on it in person.

QA reopens the bug again. “Room still lit” it says. After looking at the unlit bulb one more time, you tell your boss, who suggests you go back down to the basement and check the wires. You protest that you are looking at the light right now and it’s off. “I know, but this way you can tell QA you checked out absolutely everything."

So you sigh and head to the basement. Sure enough, the wires are not connected. The ends are capped. They are not resting on anything that could conduct electricity.

You report back to QA that you checked the wires, which are not connected, and that you looked at the bulb, which was unlit.

“I didn’t mean the bulb,” says QA. “The bug is about light in the room. There’s still too much light. Shouldn’t you close the blinds?"

You respond that the blinds don’t fall under your control, and that the bug specifies the light being turned off.

Not believing you, QA sends out a group email asking if the blinds are covered by the bug.

Some time passes before you hear from anyone. Finally someone from the email chain calls you.

“Theoretically,” they ask, “could someone participating in a meeting in the conference room on 26 open or close the blinds by themselves if it was too bright or too dark?"

Yes they could, you reply.

“Like, an ordinary person? They wouldn’t need you to do it?"

Yes, an ordinary person. No, they wouldn’t need you. Anyone can do it.

“Great. Excellent. Then we’ll leave that for now. I’ll schedule a stand-up meeting about the blinds issue."

So the bug is closed. Now, the CEO, possibly having caught wind of all the discussion and furtive activity surrounding the conference room on 26, wants to have a meeting there. You get several panicked emails that they need the light on.

You go to the basement, connect the wires, and return to your desk, to find 32 new messages in your inbox. “Something’s wrong—the light’s not on!” “There’s a problem — no light!” “Are you getting these emails?” and so on.

The 32nd email says, “Nevermind—the light’s on."

This process is repeated more or less exactly when it’s time to turn the light off again.

But if there’s any good news, it’s this: after the meeting, everyone forgets that there even is a conference room on 26, so you never have to do anything about it again.

Wow, gold! Thanks!

]]>
using gcc_x86 assembly to scan the most significant one bit and the least significant one bithttp://m.shnenglu.com/Chipset/archive/2014/06/15/207298.html灞卞縐戞妧灞卞縐戞妧Sun, 15 Jun 2014 09:38:00 GMThttp://m.shnenglu.com/Chipset/archive/2014/06/15/207298.htmlhttp://m.shnenglu.com/Chipset/comments/207298.htmlhttp://m.shnenglu.com/Chipset/archive/2014/06/15/207298.html#Feedback0http://m.shnenglu.com/Chipset/comments/commentRss/207298.htmlhttp://m.shnenglu.com/Chipset/services/trackbacks/207298.html
 1 #ifdef __GNUC__
 2 
 3 #if (defined _WIN64 || defined __x86_64__)
 4 
 5 /**
 6  * ../bit_scan_forward
 7  * @return index (0..63) of least significant one bit
 8  */
 9 unsigned bit_scan_forward(unsigned long long x)
10 {
11    asm("bsfq %0, %0" : "=r" (x) : "0" (x));
12    return unsigned(x);
13 }
14 
15 /**
16  * bit_scan_reverse
17  * @return index (0..63) of most significant one bit
18  */
19 unsigned bit_scan_reverse(unsigned long long x)
20 {
21    asm("bsrq %0, %0" : "=r" (x) : "0" (x));
22    return unsigned(x);
23 }
24 
25 #elif (defined _WIN32) || (defined __linux__)
26 
27 /**
28  * ../bit_scan_forward
29  * @return index (0..63) of least significant one bit
30  */
31 unsigned bit_scan_forward(unsigned long long x)
32 {
33    asm("bsf %0, %0" : "=r" (x) : "0" (x));
34    return unsigned(x);
35 }
36 
37 /**
38  * bit_scan_reverse
39  * @return index (0..63) of most significant one bit
40  */
41 unsigned bit_scan_reverse(unsigned long long x)
42 {
43    asm("bsr %0, %0" : "=r" (x) : "0" (x));
44    return unsigned(x);
45 }
46 
47 #endif
48 
49 #endif


]]>
Is there an ISO standard for C sharp language?http://m.shnenglu.com/Chipset/archive/2011/09/27/156961.html灞卞縐戞妧灞卞縐戞妧Tue, 27 Sep 2011 06:43:00 GMThttp://m.shnenglu.com/Chipset/archive/2011/09/27/156961.htmlhttp://m.shnenglu.com/Chipset/comments/156961.htmlhttp://m.shnenglu.com/Chipset/archive/2011/09/27/156961.html#Feedback1http://m.shnenglu.com/Chipset/comments/commentRss/156961.htmlhttp://m.shnenglu.com/Chipset/services/trackbacks/156961.html

浠婂ぉ鐪嬭佸鍐欑殑鏂囩珷鎻愬埌浜?/span>C#鍥介檯鏍囧噯

浠涔堬紝C#榪樻湁鍥介檯鏍囧噯錛熶笉浼氬惂錛熻胺姝屼竴涓嬶紝鏋滅劧濡傛錛?/span>06騫村氨鏈変簡ISO鏍囧噯灞呯劧榪樿兘浠?/span>ISO瀹樼綉涓嬭澆鍒扮數瀛愮増銆?/span>

鐪嬫潵閲戦挶灝辨槸濂戒笢瑗垮晩錛屾湁閽辮兘浣塊鎺ㄧ(閬撶悊鍦ㄥ湴鐞冧笂鍝噷閮藉ソ鐢?/span>…

緇х畫璋鋒瓕錛屽湪MSDN涓婂彂鐜頒簡涓嬮潰鐨勬枃瀛椼?/span>

榪炴帴錛?/span>http://msdn.microsoft.com/en-us/netframework/aa569283

In June 2005, the General Assembly of the international standardization organization Ecma approved edition 3 of the C# Language and the Common Language Infrastructure (CLI) specifications, as updated Ecma-334 and Ecma-335, respectively (see press release). The updated technical report on the CLI, Ecma TR-84, and a new technical report on the CLI, Ecma TR-89, were also ratified.

In July 2005, Ecma submitted the Standards and TRs to ISO/IEC JTC 1 via the ISO Fast-Track process. The Standards were adopted in April 2006 as ISO/IEC 23270:2006 (C#), ISO/IEC 23270:2006 (CLI), ISO/IEC TR 23272:2006 (CLI, XML Libraries) and ISO ISO/IEC TR 25438:2006 (CLI, Common Generics).

In July 2006 the General Assembly of Ecma approved edition 4 of the Standards which correspond to the ISO 2006 versions.

Latest Standards

The following official Ecma documents are available for C# and the CLI (TR-84, TR-89). These links are direct from Ecma:

 

File name

 

Size (Bytes)

 

Content

 

ECMA-334.pdf

 

2 614 003

 

C# Language Specification

 

ECMA-335.pdf

 

3 219 107

 

Common Language Infrastructure

 

ECMA-335.zip

 

754 982

 

XML-based Library Specification

 

TR-084.pdf

 

187 450

 

Information Derived from Partition IV XML File

 

TR-084.zip

 

19 329 610

 

XML Tool, Libraries in Microsoft© Word and PDF

 

TR-089.pdf

 

589 400

 

Common Generics Library

 

TR-089.zip

 

461 074

 

Common Generics Library Reference Implementation

Reference implementation for TR-89
Reference implementation for the Parallel API

The official ISO/IEC documents are available from the ISO/IEC Freely Available Standards page. These links are direct from that page:

 

File name

 

Content

 

ISO/IEC 23270:2006

 

Information technology -- Programming languages -- C#

 

ISO/IEC 23271:2006
- Software

 

Information technology -- Common Language Infrastructure (CLI)
Partitions I to VI

 

ISO/IEC TR 23272:2006
- Software

 

Information technology -- Common Language Infrastructure (CLI)
-- Technical Report on Information Derived from Partition IV XML File

 

ISO/IEC TR 25438:2006
- Software

 

Information technology -- Common Language Infrastructure (CLI)
-- Technical Report: Common Generics

Current Working Draft

Work on the 5th edition of Ecma-335 CLI standard began in mid-2009. The TC49-TG3 task group is working on extending both the virtual machine and class libraries of the CLI specification. In addition, improvements are being made to clarify existing elements of the specification. Many of these improvements are the result of feedback received from outside the task group, for which the task group is grateful.

Posted below is a snapshot of the committee's work as of 27 March 2010.

The participants in TC49/TG3 are providing these working documents to the public for informational purposes only. The contents are subject to change as often as once a month. To participate in the standardization process, contact your organization's Ecma representative. If your company does not currently participate in Ecma and wishes to do so, please contact ECMA directly.

The following organizations and contributors are actively participating in the work of TC49/TG3:
Eiffel Software, Microsoft Corporation, Novell Corporation, Kahu Research, and Twin Roots.

Many of the organizations that are currently participating in the TC49/TG3 work have volunteered to mirror this site. The URLs for the mirror sites are:
- Eiffel Software
- Microsoft Corporation
- Novell Corporation
- Kahu Research
- Twin Roots

Available Documents (Documents current as of 27 March 2010)
The following working draft documents are available:

- CLI Partition I - Architecture (word/pdf zip)
- CLI Partition II - Metadata and File Format (word/pdf zip)
- CLI Partition III - CIL (word/pdf zip)
- CLI Partition IV - Library (word/pdf zip)
- CLI Partition V - Binary Formats (word/pdf zip)
- CLI Partition VI - Annexes (word/pdf zip)
- Class Library XML (xml zip)
- Class Library Detailed Specifications (word/pdf zip)

Annotated Standards

Members of the Standard committees and others have combined to produce annotated versions of the Standards. These are:

  • The Common Language Infrastructure Annotated Standard, James S. Miller & Susann Ragsdale, Addison-Wesley, 2004, ISBN 0-321-15493-2 (based on Edition 2 of Ecma-335)
  • C# Annotated Standard, Jon Jagger, Nigel Perry & Peter Sestoft, Morgan Kaufmann, 2007, ISBN 978-0-12-372511-0 (based on Edition 4 of Ecma-334)

Microsoft Implementation Specific Versions

The following documents are versions of the Standards with Microsoft implementation-specific notes added. These notes provide extra information about Microsoft's Common Language Runtime (CLR) implementation of the CLI.

 

File name

 

Size (Bytes)

 

Content

 

MS Partition I.pdf

 

815 983

 

Common Language Infrastructure, Partition I: Concepts and Architecture

 

MS Partition II.pdf

 

1 758 195

 

Common Language Infrastructure, Partition II: Metadata Definition and Semantics

 

MS Partition III.pdf

 

661 414

 

Common Language Infrastructure, Partition III: CIL Instruction Set

 

MS Partition IV.pdf

 

 

 

Common Language Infrastructure, Partition IV: Profiles and Libraries

 

MS Partition V.pdf

 

 

 

Common Language Infrastructure, Partition V: Binary Formats

 

MS Partition VI.pdf

 

 

 

Common Language Infrastructure, Partition VI: Annexes

The Ecma 4th and ISO 2nd Editions

Aside from bug fixes, major enhancements from previous editions include:

CLI

  • First-class support for generics at the runtime and class library level
  • An API to help developers begin multithreaded and parallel programming
  • Enhancements to the Common Intermediate Language (CIL) and Common Language Specification (CLS)
  • An interchangeable debug format

C#

  • First-class language support for generics
  • Anonymous methods
  • Iterators
  • Nullable Types

Previous Editions Background

In August, 2000, Microsoft Corporation, Hewlett-Packard and Intel Corporation co-sponsored the submission of specifications for the Common Language Infrastructure (CLI) and C# programming language to the international standardization organization Ecma. As a result, Ecma formed two task groups (TG3 and TG2, respectively) within TC39, its technical committee responsible for programming languages and application development.

During the next year, the co-sponsor companies, in conjunction with other Ecma members and guests (including IBM, Fujitsu Software, Plum Hall, Monash University and ISE), refined these specifications into standards. In December, 2001, the Ecma General Assembly ratified the 1st edition of the C# and CLI standards as Ecma-334 and Ecma-335, respectively. A technical report on the CLI, Ecma TR-84, was also ratified.

In late December, 2001, Ecma submitted the standards and TR to ISO/IEC JTC 1 via the latter's Fast-Track process. The subsequent 6-month evaluation and comment period resulted in two NO votes (Japan and UK) on the draft standards, and one NO vote (Japan) on the draft TR. All comments resulting from this review were considered at a ballot resolution meeting held in October, 2002. The two NO votes on the standards were resolved, making acceptance unanimous. However, Japan did not change its NO vote on the draft TR (Japan would like to see a formatted/readable rendering of the CLI class library as part of the standard, not as a TR; this will be considered for a future edition).

The ISO/IEC standards and TR were published in April, 2003, and are known formally as ISO/IEC 23270 (C#), ISO/IEC 23271 (CLI) and ISO/IEC 23272 (CLI TR). Equivalent specifications were adopted as 2nd edition standards and TR by Ecma at its December, 2002, General Assembly.

Joining Ecma

To participate in the standardization process, contact your organization’s Ecma representative. If your company does not currently participate in Ecma and wishes to do so, please contact Ecma directly.

Acknowledgements

The following organizations have participated in the work of Ecma TC39/TG2 and TC39/TG3 and their contributions are gratefully acknowledged: Borland, Fujitsu, Hewlett-Packard, Intel Corporation, International Business Machines, ISE, IT University Copenhagen, JSL (UK), Kahu Research (New Zealand), Microsoft Corporation, Monash University, Netscape, Novell Corporation, OpenWave, Plum Hall, Sun Microsystems.

Many of the organizations that have participated in the TC39/TG2 and TC39/TG3 work have volunteered to mirror this site. The links for the mirror sites are:




]]>
涓涓瘝浜蹭竴鐢熺殑8涓皫璦(杞?http://m.shnenglu.com/Chipset/archive/2011/09/07/155267.html灞卞縐戞妧灞卞縐戞妧Wed, 07 Sep 2011 03:12:00 GMThttp://m.shnenglu.com/Chipset/archive/2011/09/07/155267.htmlhttp://m.shnenglu.com/Chipset/comments/155267.htmlhttp://m.shnenglu.com/Chipset/archive/2011/09/07/155267.html#Feedback3http://m.shnenglu.com/Chipset/comments/commentRss/155267.htmlhttp://m.shnenglu.com/Chipset/services/trackbacks/155267.html

杞創錛屽凡緇忚涓嶆竻鍑哄錛屾姳姝夈?/p>


1銆佸効鏃訛紝灝忕敺瀛╁寰堢┓錛屽悆楗椂錛岄キ甯稿父涓嶅鍚冿紝姣嶄翰灝辨妸鑷繁紕楅噷鐨勯キ鍒嗙粰瀛╁瓙鍚冦傛瘝浜茶錛屽瀛愪滑錛屽揩鍚冨惂錛屾垜涓嶉タ錛?#8212;—姣嶄翰鎾掔殑絎竴涓皫

銆銆

2銆佺敺瀛╅暱韜綋鐨勬椂鍊欙紝鍕ゅ姵鐨勬瘝浜插父鐢ㄥ懆鏃ヤ紤鎭椂闂村幓鍘塊儕鍐滄潙娌蟲矡閲屾崬浜涢奔鏉ョ粰瀛╁瓙浠ˉ閽欍傞奔 寰堝ソ鍚冿紝楸兼堡涔熷緢椴溿傚瀛愪滑鍚冮奔鐨勬椂鍊欙紝姣嶄翰灝卞湪涓鏃佸晝楸奸澶達紝鐢ㄨ垖澶磋垟楸奸澶翠笂鐨勮倝娓嶃傜敺瀛╁績鐤鹼紝灝辨妸鑷繁紕楅噷鐨勯奔澶瑰埌姣嶄翰紕楅噷錛岃姣嶄翰鍚冮奔銆傛瘝浜蹭笉 鍚冿紝姣嶄翰鍙堢敤絳峰瓙鎶婇奔澶瑰洖鐢峰鐨勭閲屻傛瘝浜茶錛屽瀛愶紝蹇悆鍚э紝鎴戜笉鐖卞悆楸鹼紒——姣嶄翰鎾掔殑絎簩涓皫

銆銆

3銆佷笂鍒濅腑浜嗭紝涓轟簡緙村鐢峰鍜屽摜濮愮殑瀛﹁垂錛屽綋緙濈韓宸ョ殑姣嶄翰灝卞幓灞呭浼氶浜涚伀鏌寸洅鎷垮洖瀹舵潵錛屾櫄涓?緋婁簡鎸g偣鍒嗗垎閽辮ˉ鐐瑰鐢ㄣ傛湁涓啲澶╋紝鐢峰鍗婂閱掓潵錛岀湅鍒版瘝浜茶繕韜潃韜瓙鍦ㄦ補鐏笅緋婄伀鏌寸洅銆傜敺瀛╄錛屾瘝浜詫紝鐫′簡鍚э紝鏄庢棭鎮ㄨ繕瑕佷笂鐝憿銆傛瘝浜茬瑧絎戯紝璇達紝瀛╁瓙錛?蹇潯鍚э紝鎴戜笉鍥幫紒——姣嶄翰鎾掔殑絎笁涓皫

銆銆

4銆侀珮鑰冮偅騫達紝姣嶄翰璇蜂簡鍋囧ぉ澶╃珯鍦ㄨ冪偣闂ㄥ彛涓哄弬鍔犻珮鑰冪殑鐢峰鍔╅樀銆傛椂閫㈢洓澶忥紝鐑堟棩褰撳ご錛屽浐鎵х殑 姣嶄翰鍦ㄧ儓鏃ヤ笅涓绔欏氨鏄嚑涓皬鏃躲傝冭瘯緇撴潫鐨勯搩澹板搷浜嗭紝姣嶄翰榪庝笂鍘婚掕繃涓鏉敤緗愬ご鐡舵場濂界殑嫻撹尪鍙槺瀛╁瓙鍠濅簡錛岃尪浜︽祿錛屾儏鏇存祿銆傛湜鐫姣嶄翰騫茶鐨勫槾鍞囧拰婊″ご鐨勬睏 鐝狅紝鐢峰灝嗘墜涓殑緗愬ご鐡跺弽閫掕繃鍘昏姣嶄翰鍠濄傛瘝浜茶錛屽瀛愶紝蹇枬鍚э紝鎴戜笉娓達紒——姣嶄翰鎾掔殑鍥涗釜璋?

銆銆

5銆佺埗浜茬梾閫濅箣鍚庯紝姣嶄翰鍙堝綋鐖瑰張褰撳錛岄潬鐫鑷繁鍦ㄧ紳綰ぞ閲岄偅鐐瑰井钖勬敹鍏ュ惈杈涜尮鑻︽媺鎵潃鍑犱釜瀛?瀛愶紝渚涗粬浠康涔︼紝鏃ュ瓙榪囧緱鑻︿笉鍫█銆傝儭鍚岃礬鍙g數綰挎潌涓嬩慨琛ㄧ殑鏉庡彅鍙旂煡閬撳悗錛屽ぇ浜嬪皬浜嬪氨鎵懼矓榪囨潵鎵撲釜甯墜錛屾惉鎼叅錛屾寫鎸戞按錛岄佷簺閽辯伯鏉ュ府琛ョ敺瀛╃殑瀹墮噷銆備漢闈?鑽夋湪錛屽鑳芥棤鎯呫傚乏閭誨彸鑸嶅姝ょ湅鍦ㄧ溂閲岋紝璁板湪蹇冮噷錛岄兘鍔濇瘝浜插啀瀚侊紝浣曞繀鑻︿簡鑷繁銆傜劧鑰屾瘝浜插騫存潵鍗村畧韜鐜夛紝濮嬬粓涓嶅珌錛屽埆浜哄啀鍔濓紝姣嶄翰涔熸柇鐒朵笉鍚紝姣嶄翰 璇達紝鎴戜笉鐖憋紒——鎾掔殑浜斾釜璋?

銆銆

6銆佺敺瀛╁拰濂圭殑鍝ュ澶у姣曚笟鍙傚姞宸ヤ綔鍚庯紝涓嬩簡宀楃殑姣嶄翰灝卞湪闄勮繎鍐滆錘甯傚満鎽嗕簡涓皬鎽婄淮鎸佺敓媧匯傝韓鍦ㄥ鍦板伐浣滅殑瀛╁瓙浠煡閬撳悗灝卞父甯稿瘎閽卞洖鏉ヨˉ璐存瘝浜詫紝姣嶄翰鍧氬喅涓嶈錛屽茍灝嗛挶閫浜嗗洖鍘匯傛瘝浜茶錛屾垜鏈夐挶錛?#8212;—鎾掔殑鍏釜璋?

銆銆

7銆佺敺瀛╃暀鏍′換鏁欎袱騫達紝鍚庡張鑰冨彇浜嗙編鍥戒竴鎵鍚嶇墝澶у鐨勫崥澹敓錛屾瘯涓氬悗鐣欏湪緹庡浗涓瀹剁鐮旀満鏋勫伐浣滐紝寰呴亣鐩稿綋涓板帤錛屾潯浠跺ソ浜嗭紝韜湪寮傚浗鐨勭敺瀛╂兂鎶婃瘝浜叉帴鏉ヤ韓浜竻紱忓嵈琚佷漢鍥炵粷浜嗐傛瘝浜茶錛屾垜涓嶄範鎯紒——鎾掔殑涓冧釜璋?

銆銆

8銆佹櫄騫達紝姣嶄翰鎮d簡鑳冪檶錛屼綇榪涗簡鍖婚櫌錛岃繙鍦ㄥぇ瑗挎磱褰煎哺鐨勭敺瀛╀箻椋炴満璧跺洖鏉ユ椂錛屾湳鍚庣殑姣嶄翰宸叉槸濂勫涓鎭簡銆傛瘝浜茶佷簡錛屾湜鐫琚梾欖旀姌紓ㄥ緱姝誨幓媧繪潵鐨勬瘝浜詫紝鐢峰鎮茬棝嬈茬粷錛屾礁鐒舵唱涓嬨傛瘝浜插嵈璇達紝瀛╁瓙錛屽埆鍝紝鎴戜笉鐤箋?#8212;—鎾掔殑鏈鍚庝竴涓皫



]]>
鏌ユ壘涓涓?4浣嶆暣鏁頒簩榪涘埗絎竴涓?http://m.shnenglu.com/Chipset/archive/2011/08/23/154114.html灞卞縐戞妧灞卞縐戞妧Tue, 23 Aug 2011 04:41:00 GMThttp://m.shnenglu.com/Chipset/archive/2011/08/23/154114.htmlhttp://m.shnenglu.com/Chipset/comments/154114.htmlhttp://m.shnenglu.com/Chipset/archive/2011/08/23/154114.html#Feedback2http://m.shnenglu.com/Chipset/comments/commentRss/154114.htmlhttp://m.shnenglu.com/Chipset/services/trackbacks/154114.html

鏈夋椂鍊欑敤鍒頒綅榪愮畻銆傞渶瑕佸揩閫熸壘鍒頒竴涓暣鏁扮殑浜岃繘鍒剁涓涓?/span>1鎴?/span>0鍦ㄥ摢涓綅(涓嬫爣)錛熶緥濡傦細鍗佽繘鍒舵暟100鐨勪簩榪涘埗鏄?/span>1100100錛岄偅涔堝畠鐨勭涓涓?/span>1鍦ㄤ笅鏍?/span> 涓?/span>2鐨勪綅緗?/span>(bsf, bit scan forward)鎴?/span>6鐨勪綅緗?/span>(bsr, bit scan in reverse order)錛岀敱浜庡彧鐢ㄤ簬瀛樺偍涓涓姸鎬侊紝鑷充簬鐢?/span>bsf榪樻槸bsr鍒欐棤鎵璋撱?/span>

瑙e喅榪欎釜闂鐨勭涓涓兂娉曞氨鏄敤鍐呰仈姹囩紪鐨勫仛娉曪紝浣跨敤鐗瑰埆鐨?/span>CPU鎸囦護鍘繪壘錛屼絾姹囩紪鐨勫彲縐繪鎬ф瘮杈冨樊錛屼笉鍚岀殑CPU鍨嬪彿浣跨敤鐨勬寚浠ゅ彲鑳戒笉涓鏍鳳紝鎵ц閫熷害涔熶笉涓鏍楓?/span>
鍋囪鎵句竴涓?/span>64浣嶆棤絎﹀彿鏁存暟浜岃繘鍒剁殑絎竴涓?/span>1錛岀敤bsf, AT& T姹囩紪(gcc姹囩紪)鍙互榪欐牱鍋氾細

 1 // bit scan forward for 64 bit integral number
 2 /* ============================================ */
 3 inline int bsf_asm (uint64_t w)
 4 {
 5   int x1, x2;
 6   asm ("bsf %0,%0\n" "jnz 1f\n" "bsf %1,%0\n" "jz 1f\n" "addl $32,%0\n"
 7      "1:": "=&q" (x1), "=&q" (x2):"1" ((int) (w >> 32)),
 8      "0" ((int) w));
 9   return x1;
10 }


濡傛灉鐢?/span>C鏉ュ疄鐜扮殑璇濓紝閭e氨鏈夌偣楹葷儲浜嗭紝鍦ㄦ涓嶈澶嶆潅鐨勬暟瀛﹀師鐞嗭紝浠呬粎緇欏嚭浠g爜銆?/span>

 1 // bit scan forward for 64 bit integral number
 2 /* ============================================ */
 3 inline int bsf_folded (uint64_t bb)
 4 {
 5      static const int lsb_64_table[64] =
 6    {
 7       63, 30,  3, 32, 59, 14, 11, 33,
 8       60, 24, 50,  9, 55, 19, 21, 34,
 9       61, 29,  2, 53, 51, 23, 41, 18,
10       56, 28,  1, 43, 46, 27,  0, 35,
11       62, 31, 58,  4,  5, 49, 54,  6,
12       15, 52, 12, 40,  7, 42, 45, 16,
13       25, 57, 48, 13, 10, 39,  8, 44,
14       20, 47, 38, 22, 17, 37, 36, 26
15    };
16    unsigned int folded;
17    bb ^= bb - 1;
18    folded = (int) bb ^ (bb >> 32);
19    return lsb_64_table[folded * 0x78291ACF >> 26];
20 }


濡傛灉鎯充粠鍚庡線鍓嶆悳绱竴涓暣鏁扮殑浜岃繘鍒剁涓涓?/span>1鐨勪笅鏍囷紝鐢ㄦ眹緙栧彲浠ヨ繖鏍峰仛銆?/span>

 1 // bit scan in reverse order for 64 bit integral number
 2 /* ============================================ */
 3 inline int bsr_asm (uint64_t w)
 4 {
 5   int x1, x2;
 6   asm ("bsr %1,%0\n" "jnz 1f\n" "bsr %0,%0\n" "subl $32,%0\n"
 7      "1: addl $32,%0\n": "=&q" (x1), "=&q" (x2):"1" ((int) (w >> 32)),
 8      "0" ((int) w));
 9   return x1;
10 }


濡傛灉鐢?/span>C鏉ュ疄鐜扮殑璇濓紝涔熸瘮杈冪畝鍗曪紝鐢?/span>divide and conquer 鐨勫師鐞嗗氨涓嶄細澶參銆?/span>

 1 // a logn (n == 32)algorithm for bit scan in reverse order
 2 /* ============================================ */
 3 inline int bsr32(uint32_t bb)
 4 {
 5      static const char msb_256_table[256] =
 6    {
 7       0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
 8       4, 4, 4, 4, 4, 4, 4, 4,4, 4, 4, 4,4, 4, 4, 4,
 9       5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
10       6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
11       6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
12       7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
13       7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
14       7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
15       7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
16    };
17    int result = 0;
18 
19    if (bb > 0xFFFF)
20      {
21       bb >>= 16;
22       result += 16;
23    }
24    if (bb > 0xFF)
25      {
26       bb >>= 8;
27       result += 8;
28    }
29 
30    return (result + msb_256_table[bb]);
31 }
32 
33 /* ============================================ */
34 inline int bsr_in_C(uint64_t bb)
35 {
36   const uint32_t hb = bb >> 32;
37   return hb ? 32 + bsr32((uint32_t)hb) : bsr32((uint32_t)bb);
38 
39 }
40 


涓嬮潰榪欎釜浼間箮涔熷彲浠ワ紝澶辮觸鏃惰繑鍥?/span>-1023錛岃嚦浜庨熷害蹇參灝辮鐪嬬紪璇戝櫒鐨勫棞濂戒簡銆?/span>

 1 // bit scan in reverse order for 64 bit integral number
 2 /* ============================================ */
 3 inline int bsr_double (uint64_t bb)
 4 {
 5    union
 6    {
 7       double d;
 8       struct
 9       {
10          unsigned int mantissal : 32;
11          unsigned int mantissah : 20;
12          unsigned int exponent : 11;
13          unsigned int sign : 1;
14       };
15    } ud;
16    ud.d = (double)(bb & ~(bb >> 32));
17    return ud.exponent - 1023;
18 }
19 


浠ヤ笂uint64_t鍜?/span>uint32_t鏄柊C++鏍囧噯鍙互鏀寔鐨勬暣鍨嬶紝鍒嗗埆鐩稿綋浜?/span>鏃х殑unsigned long long鍜?/span>unsigned long綾誨瀷銆?span style="color:blue">浠ヤ笂浠g爜涓嶆槸鎴戠殑鍘熷垱錛岃屾槸鏉ヨ嚜鍥藉鏌愪綅鏈嬪弸錛屾垜紼嶅井鍔犲伐浜嗕竴涓嬭創鍒拌繖閲岋紝鐗堟潈灞炰簬鍘熶綔鑰咃紝濡傛灉鎴戞病鏈夎閿欑殑璇濆簲璇ユ槸GNU銆?/span>


]]>
鎱堝杽鐨勬槸蹇冭屼笉鏄挶http://m.shnenglu.com/Chipset/archive/2011/08/19/153849.html灞卞縐戞妧灞卞縐戞妧Fri, 19 Aug 2011 06:47:00 GMThttp://m.shnenglu.com/Chipset/archive/2011/08/19/153849.htmlhttp://m.shnenglu.com/Chipset/comments/153849.htmlhttp://m.shnenglu.com/Chipset/archive/2011/08/19/153849.html#Feedback0http://m.shnenglu.com/Chipset/comments/commentRss/153849.htmlhttp://m.shnenglu.com/Chipset/services/trackbacks/153849.html

2007騫村垵錛屽垰鍒氬嵏浠葷殑鑱斿悎鍥界涔﹂暱瀹夊崡錛屽湪寰峰厠钀ㄦ柉宸炵殑涓涓簞鍥噷涓捐浜嗕竴鍦烘厛鍠勬櫄瀹達紝鏃ㄥ湪涓洪潪媧茶傳鍥板効绔ュ嫙鎹愩傚簲閭鍙傚姞鏅氬鐨勯兘鏄瘜鍟嗗拰紺句細鍚嶆祦銆傚湪鏅氬灝嗚寮濮嬬殑鏃跺欙紝涓浣嶈佸浜洪鐫涓涓皬濂沖鏉ュ埌浜嗗簞鍥殑鍏ュ彛澶勶紝灝忓コ瀛╂墜閲屾崸鐫涓涓湅涓婂幓寰堢簿鑷寸殑鐡風綈銆?/span>

 瀹堝湪搴勫洯鍏ュ彛澶勭殑淇濆畨瀹変笢灝兼嫤浣忎簡榪欎竴鑰佷竴灝忋?#8220;嬈㈣繋浣犱滑錛岃鍑虹ず璇鋒煬錛岃阿璋€?#8221;銆?/span>

“璇鋒煬錛屽涓嶈搗錛屾垜浠病鏈夋帴鍒伴個璇鳳紝鏄ス瑕佹潵錛屾垜闄ス鏉ョ殑銆?#8221;鑰佸浜烘姎鎽哥潃灝忓コ瀛╃殑澶淬?/span>

 “寰堟姳姝夛紝闄や簡宸ヤ綔浜哄憳錛屾病鏈夎鏌殑浜轟笉鑳借繘鍘匯?#8221;瀹変笢灝艱銆?/span>

“涓轟粈涔堬紵榪欓噷涓嶆槸涓捐鎱堝杽鏅氬鍚楋紵鎴戜滑鏄潵琛ㄧず鎴戜滑鐨勫績鎰忕殑錛岄毦閬撲笉鍙互鍚楋紵”鑰佸浜虹殑琛ㄦ儏寰堜弗鑲冿紝“鍙埍鐨勫皬闇茶タ錛屼粠鐢佃涓婄煡閬撲簡榪欓噷瑕佷負闈炴床鐨勫瀛愪滑涓捐鎱堝杽媧誨姩錛屽ス寰堟兂涓洪偅浜涘彲鎬滅殑瀛╁瓙鍋氱偣浜嬶紝鍐沖畾鎶婅嚜宸卞偍閽辯綈閲屾墍鏈夌殑閽遍兘鎷垮嚭鏉ワ紝鎴戝彲浠ヤ笉榪涘幓錛岀湡鐨勪笉鑳借濂硅繘鍘誨悧錛?#8221;

“鏄殑錛岃繖閲屽皢瑕佷婦琛屼竴鍦烘厛鍠勬櫄瀹達紝搴旈個鍙傚姞鐨勯兘鏄緢閲嶈鐨勪漢澹紝浠栦滑灝嗕負闈炴床鐨勫瀛愭叿鎱ㄨВ鍥娿傚緢楂樺叴浣犱滑甯︾潃鐖卞績鏉ュ埌榪欓噷錛屼絾鏄紝鎴戞兂榪欏満鍚堜笉閫傚悎浣犱滑榪涘幓銆?#8221;瀹変笢灝艱В閲婅銆?/span>

“鍙斿彅錛屾厛鍠勭殑涓嶆槸閽憋紝鏄績錛屽鍚楋紵”涓鐩存病鏈夎璇濈殑灝忓コ瀛╅棶瀹変笢灝鹼紝濂圭殑璇濊瀹変笢灝兼劊浣忎簡銆?#8220;鎴戠煡閬撴敹鍒伴個璇風殑浜烘湁寰堝閽憋紝浠栦滑浼氭嬁鍑哄緢澶氶挶錛屾垜娌℃湁閭d箞澶氾紝浣嗚繖鏄垜鎵鏈夌殑閽卞晩錛屽鏋滄垜鐪熺殑涓嶈兘榪涘幓錛岃甯垜鎶婅繖涓甫榪涘幓鍚э紒”灝忓コ瀛╅湶瑗胯瀹岋紝灝嗘墜涓殑鍌ㄩ挶緗愰掔粰瀹変笢灝箋?/span>

瀹変笢灝間笉鐭ラ亾鏄帴榪樻槸涓嶆帴錛屾鍦ㄤ粬涓嶇煡鎵鎺殑鏃跺欙紝紿佺劧鏈変漢璇達細“涓嶇敤浜嗭紝瀛╁瓙錛屼綘璇村緱瀵癸紝鎱堝杽鐨勪笉鏄挶錛屾槸蹇冿紝浣犲彲浠ヨ繘鍘伙紝鎵鏈夋湁鐖卞績鐨勪漢閮藉彲浠ヨ繘鍘匯?#8221;璇磋瘽鐨勬槸涓浣嶈佸ご錛屼粬闈㈠甫寰瑧錛岀珯鍦ㄥ皬闇茶タ韜梺銆備粬韜韓鍜屽皬闇茶タ浜よ皥浜嗗嚑鍙ワ紝鐒跺悗鐩磋韓璧鋒潵錛屾嬁鍑轟竴浠借鏌掔粰瀹変笢灝鹼細“鎴戝彲浠ュ甫濂硅繘鍘誨悧錛?#8221;

瀹変笢灝兼帴榪囪鏌紝鎵撳紑涓鐪嬶紝蹇欏悜鑰佸ご鏁簡涓ぜ錛?#8220;褰撶劧鍙互浜嗭紝娌冧雞·宸磋彶鐗瑰厛鐢熴?#8221;

褰撳ぉ鎱堝杽鏅氬鐨勪富瑙掍笉鏄¤鑰呯殑瀹夊崡錛屼笉鏄崘鍑?00涓囩編鍏冪殑宸磋彶鐗癸紝涔熶笉鏄崘鍑?00涓囩編鍏冪殑姣斿皵·鐩栬尐錛岃屾槸浠呬粎鎹愬嚭30緹庡厓闆?5緹庡垎鐨勫皬闇茶タ錛屽ス璧㈠緱浜嗘渶澶氭渶鐑儓鐨勬帉澹般傝屾櫄瀹寸殑涓婚鏍囪涔熷彉鎴愪簡榪欐牱涓鍙ヨ瘽“鎱堝杽鐨勪笉鏄挶錛屾槸蹇冦?#8221;絎簩澶╋紝緹庡浗鍚勫ぇ濯掍綋綰風悍浠ヨ繖鍙ヨ瘽浣滀負鏍囬錛屾姤閬撲簡榪欐鎱堝杽鏅氬銆傜湅鍒版姤閬撳悗錛岃澶氭櫘鏅氶氱殑緹庡浗浜虹悍綰瘋〃紺鴻涓洪潪媧查偅浜涜傳絀風殑瀛╁瓙鎹愯禒銆?/span>



]]>
B+鏍戠殑C++瀹炵幇http://m.shnenglu.com/Chipset/archive/2011/08/16/153564.html灞卞縐戞妧灞卞縐戞妧Tue, 16 Aug 2011 07:05:00 GMThttp://m.shnenglu.com/Chipset/archive/2011/08/16/153564.htmlhttp://m.shnenglu.com/Chipset/comments/153564.htmlhttp://m.shnenglu.com/Chipset/archive/2011/08/16/153564.html#Feedback0http://m.shnenglu.com/Chipset/comments/commentRss/153564.htmlhttp://m.shnenglu.com/Chipset/services/trackbacks/153564.html鍏充簬B+鏍戠殑瀹炵幇鍜屾祴璇曪紝鎴戣榪囩殑鏈璇︾粏鐨凜++浠g爜鍦細
http://idlebox.net/2007/stx-btree/
涓浣嶅痙鍥芥湅鍙嬬殑鏉頒綔銆?/div>

]]>
鏋舵瀯甯堝凡姝?杞創)http://m.shnenglu.com/Chipset/archive/2011/02/01/139658.html灞卞縐戞妧灞卞縐戞妧Tue, 01 Feb 2011 00:58:00 GMThttp://m.shnenglu.com/Chipset/archive/2011/02/01/139658.htmlhttp://m.shnenglu.com/Chipset/comments/139658.htmlhttp://m.shnenglu.com/Chipset/archive/2011/02/01/139658.html#Feedback4http://m.shnenglu.com/Chipset/comments/commentRss/139658.htmlhttp://m.shnenglu.com/Chipset/services/trackbacks/139658.html Normal 0 false false false MicrosoftInternetExplorer4

2006騫寸殑鑱屽満鍑哄鐨勫喎娓咃紝鐩告瘮鍓嶅嚑騫達紝綆鍘嗙殑鏁伴噺鍜岃川閲忛兘澶т負涓嶅錛屽緢闅懼緱鎵懼埌涓夊勾宸ヤ綔緇忛獙浠ヤ笂鐨勪漢錛屾湁涓涓?/span> 涓嶆槸鐗瑰埆絎紝灝辨槸鐗瑰埆鎬傚氨鏄箞錛屽共寰楀ソ璋佹病浜嬫崲宸ヤ綔鍟婏紒Simon鏄竴瀹跺浼佽蔣浠跺叕鍙哥殑鎬葷粡鐞嗭紝鏈榪戠粰榪欎釜闂鎰佸潖浜嗐傞」鐩竴涓帴涓涓殑鎺ヤ笅鏉ワ紝浜烘墜瓚?/span> 鏉ヨ秺绱у紶銆傝櫧鐒?/span>Simon鏄釜鏋侀檺緙栫▼鐨勭矇涓濓紝浣嗕篃涓嶅緱涓嶆壒鍑嗕簡涓浠藉張涓浠界殑鍔犵彮鐢寵銆?/span>HR緇忕悊鎶婅繖涓棶棰樺綊緇撳埌鎴夸環涓婏紝浠栫殑濡欒鏄?/span>“鎬曞け涓氫簡榪樹笉涓婃埧 嬈撅紝涓嶆暍璺蟲Ы銆?/span>

榪欏ぉ錛?/span>K欏圭洰緇勯暱Allen緇堜簬蹇嶄笉浣忎簡錛屽甫浜嗕竴涓彧鏈変竴騫村伐浣滅粡楠岀殑灝忎紮瀛愯Simon闈㈣瘯錛?/span>“寰堣仾鏄庯紒緇忛獙灝戜簡鐐廣?/span>”

Simon鐨變簡鐨辯湁姣涳紝璇達細浣犱笉鐭ラ亾榪欎釜鑱屼綅鏈浣庤姹傛槸涓夊勾宸ヤ綔緇忛獙鍚楋紵

Allen璇達細榪欏凡緇忔槸涓変釜鏈堥噷閫氳繃鎶鏈冭瘯涓渶濂界殑涓涓簡錛岃佸ぇ錛岃瘯璇曞惂銆?/span>”Allen鏄?/span>Simon澶氬勾鐨勫摜浠紝姣旇緝闅忎究銆?/span>

鎶靛埌闈㈠瓙涓婃潵錛?/span>Simon鍙ソ璁?/span>Allen鎶婂皬浼欏瓙甯﹁繘鏉ャ?/span>

Simon鐨勯潰璇曢氬父鏄笁姝ユ洸錛?/span>

闂涓錛氫綘鑳借璇存瘯涓氬悗鐨勪富瑕佸伐浣滅粡鍘嗗悧錛?/span>

闂浜岋細鍐嶈璇翠綘鍦ㄥ叕鍙哥殑鍦頒綅錛?/span>

闂涓夛細浣犵殑鍙戝睍鐩爣鏄粈涔堬紵絳夊洖絳斿悗錛屾瘮濡傝鏋舵瀯甯堬紝浠栧氨璺熺潃闂細鎯寵薄涓涓嬩綘褰撴灦鏋勫笀鐨勪竴澶╋紝璇寸粰鎴戝惉鍚紵

灝忎紮瀛愬洖絳旂涓闂寰堝揩寰堟竻妤氾紝涓騫村伐浣滃綋鐒舵病浠涔堜笢瑗褲?/span>Simon瑙夊緱灝忎紮瀛愭尯鑱槑銆傛墍浠ュ湪灝忎紮瀛愬洖絳斾簡絎簩涓棶棰樺悗錛岄棶浜嗕竴涓彂鏁fх殑闂錛?/span>“浣犲垰鎵嶈浣犲湪鍏徃閲屽浜庝腑絳夋按騫籌紝閭f瘮浣犲樊鐨勪漢涓轟粈涔堜細姣斾綘宸憿錛?/span>”

榪欎釜闂鏄釜闄烽槺銆?/span>

灝忎紮瀛愬啋鍐掑け澶卞洖絳旇錛?/span>“鎴戣寰椾粬浠瘡澶╁伐浣滄槸涓哄伐浣滆屽伐浣滐紝宸ヤ綔娌℃湁璐d換鎰熴?/span>”

Simon鐐圭偣澶磋錛?/span>“鏄悧錛熼偅鐪熸槸緋熺硶鐨勫憳宸ャ傞偅浣犲垰濂芥瘮緋熺硶鐨勫憳宸ュソ涓鐐逛簡錛?/span>”

灝忎紮瀛愮殑鑴鎬竴涓嬪瓙綰簡錛?/span>“鎴戜笉鏄繖涓剰鎬?/span>……”

濂戒簡錛岄偅浣犺璇存瘮浣犲ソ鐨勪漢涓轟粈涔堟瘮浣犲己錛?/span>”

鎴戣寰椾粬闈炲父鍔姏錛屽伐浣滃緢澶氬勾浜嗚繕鍦ㄥ涔犲悇縐嶆瀯鏋訛紝姘村鉤寰堥珮銆?/span>”浜庢槸Simon灝遍棶閭f渶鍚庝竴涓棶棰樸傛灉鐒訛紝灝忎紮瀛愬洖絳旂殑鏄鎴愪負鏋舵瀯甯堛傚ぇ姒?/span>70錛呯殑浜烘兂鎴愪負鏋舵瀯甯堛備絾鏄灦鏋勫笀鏄粈涔堝憿錛?/span>

Simon闂亾錛?/span>“閭d綘涓轟粈涔堣鎴愪負鏋舵瀯甯堝憿錛?/span>”

灝忎紮瀛愪竴鎰o紝澶ф榪樻病鏈変漢榪欎箞緗枒榪囦粬銆?/span>“騫寸邯澶т簡錛屼笉鑳借佸啓紼嬪簭鍚с?/span>”榪欎釜鍥炵瓟錛岃Simon鎯寵搗鍏充簬浠栧浠涔堟槸鑰佺殑瀹氫箟錛氬綋浣犲笇鏈涘仛騫磋交浜哄仛鐨勪簨鎯呮椂錛屼綘灝辮繕騫磋交錛涘鏋滀綘甯屾湜鍋氳佸勾浜哄仛鐨勪簨鎯咃紝浣犲氨鑰佷簡銆傝繖鍜屼綘鍑虹敓浜嗗闀挎椂闂存槸娌℃湁鍏崇郴鐨勩?/span>

Simon鎺ョ潃闂細濂藉惂錛岄偅浣犺璇翠綘鎴愪負鏋舵瀯甯堜互鍚庯紝姣忓ぉ閮戒細鍋氫粈涔堬紵

灝忎紮瀛愯錛?/span>“鎴戣繕娌℃兂榪囷紝涓嶈繃錛屾垜鎯沖簲璇ヤ富瑕佹槸闇姹傚垎鏋愶紝璁捐鏋勬灦鍚?/span>……”榪欏ぇ姒傛槸鐜板湪騫磋交浜虹殑閫氱梾錛屽勾杞諱漢寰堝鏄撹拷閫愪竴浜涜嚜宸變篃涓嶆竻妤氱殑鐩爣銆?/span>

Simon闂細閭h璁℃瀯鏋跺叿浣撻兘鍋氫簺浠涔堝憿錛?/span>”

灝忎紮瀛愯繖嬈$殑鍥炵瓟鏄細姣斿錛岄夋嫨紼嬪簭妗嗘灦錛屽喅瀹氱敤Spring鎴?/span>Struts絳夌瓑銆?/span>”

鍝︼紝閭f垜闂綘錛屼綘鎬庝箞璇存湇鍒漢鏄敤Spring榪樻槸Struts鍛紵

濡傛灉鎴戞湁緇忛獙錛屾垜浼氱煡閬撳摢涓洿濂?/span>……”

鏄悧錛屼絾鍏充簬Spring鎴?/span>Struts鐨勭煡璇嗕換璋侀兘鍙互寰堝鏄撳緱鍒般傚鏋滃埆浜轟笉鍚屾剰浣犵殑寤鴻錛屼綘鎬庝箞璇存湇浠栵紵濡傛灉鍚屾剰浣犵殑寤鴻錛岄偅浣犱笉榪囨槸浣滃嚭浜嗗拰鍒漢涓鏍風殑璁よ瘑錛屽埆浜哄張鍑粈涔堣鍙綘鍛紵

灝忎紮瀛愭病鎯寵繃鏋舵瀯甯堟棩瀛愰噷榪樻湁涓涓鏈嶄漢鐨勫伐浣滐紝璇達細鎴戞槸鏋舵瀯甯堬紝鎴戝簲璇ユ湁鏉冨姏鍋氬喅瀹氬惂錛?/span>”

Simon鎯寵搗鏉冨姏鐨勪笁縐嶅眰嬈★紝絎竴灞傦紝浠誨懡錛涚浜屽眰錛屼笓涓氾紱絎笁灞傦紝鍝佸痙銆?/span>

Simon闂細濡傛灉鍦ㄤ竴涓垚鐔熺殑杞歡浼佷笟閲屾病鏈変綘鎵鎯寵薄鐨勬灦鏋勫笀鍛紵鎴栬呰錛屾灦鏋勫笀榪欑鑱屼笟宸茬粡姝諱骸鎴栨秷澶變簡鍛紵浣犱細鎬庝箞瀹氫綅浣犵殑鑱屼笟錛?/span>”

灝忎紮瀛愭樉寰楀緢闇囨儕銆?/span>

Simon鐢諱簡涓涓郴緇熸瀯鏋訛紝鐒跺悗鍙堢粰灝忎紮瀛愮湅浜嗕竴孌典唬鐮併?/span>

閭d竴涓洿闅炬噦錛?/span>”Simon闂?/span>

灝忎紮瀛愭寚鐫浠g爜璇達細浠g爜闅炬噦銆?/span>”

Simon鐨勮В閲婃槸錛?/span>“榪欏氨鏄負浠涔堝疄闄呬笂鎵璋撶殑鏋舵瀯甯堜笉瀛樺湪鐨勫師鍥犮備竴涓洿綆鍗曠殑涓滆タ鎬庝箞浼氭洿鏈変環鍊煎憿錛熸瘡涓漢閮借兘澶熺敾鍑鴻繖縐嶆瀯鏋跺浘錛屼絾涓嶆槸姣忎釜浜洪兘鑳藉啓鍑哄ソ鐨勪唬鐮併?/span>”

閫佽蛋浜嗗皬浼欏瓙錛?/span>Simon鏈夌偣闅懼彈銆備粬鏈夌偣鍠滄榪欎釜灝忎紮瀛愶紝浣嗘槸錛岃繖鍙堟槸涓涓鎰氳牏鐨勬暀鑲插拰璇漢瀛愬紵鐨勬妧鏈潅蹇楁薄鏌撶殑瀹朵紮銆?/span>Simon鍦ㄨ嚜宸辯殑絎旇鏈腑鍔犱簡涓鍙ヨ瘽錛氫腑鍥界▼搴忓憳鏈鎰氳牏鐨勮璇嗕箣涓夛細鎴戞兂褰撴灦鏋勫笀銆傚墠闈袱涓但鐒舵槸錛?/span>

35宀佸悗鍐欎笉鍔ㄧ▼搴忎簡錛?/span>

鎴戝彧瑕佸仛Java錛?/span>C錛嬶紜錛夛紱

 



]]>
C++/C#/F#/Java/JS/Lua/Python/Ruby娓叉煋閫熷害姣旇瘯http://m.shnenglu.com/Chipset/archive/2010/12/02/135260.html灞卞縐戞妧灞卞縐戞妧Thu, 02 Dec 2010 05:23:00 GMThttp://m.shnenglu.com/Chipset/archive/2010/12/02/135260.htmlhttp://m.shnenglu.com/Chipset/comments/135260.htmlhttp://m.shnenglu.com/Chipset/archive/2010/12/02/135260.html#Feedback4http://m.shnenglu.com/Chipset/comments/commentRss/135260.htmlhttp://m.shnenglu.com/Chipset/services/trackbacks/135260.html
榪樻浘緇忓惉涓嶅皯浜洪紦鍚硅繃鑴氭湰錛岃鑴氭湰紼嬪簭姣擟++紼嬪簭鎱笉浜嗗灝戯紝鏈変漢鐢氳嚦緇?0%錛屽姝ゆ垜涓嶅姞璇勮浜嗭紝鐪嬬湅榪欓噷鐨勬祴璇曠粨鏋滃氨涓鐩簡鐒躲?br>
涓嬮潰鏈変釜嫻偣瀵嗛泦鍨嬬殑璁$畻紼嬪簭錛屾病鏈変嬌鐢╞litz++鍜孧TL錛屽緢絎﹀悎涓鑸у簲鐢紝濡傛灉鐢ㄤ笂浠栦滑閭e氨涓嶅ソ璇存庝箞鏍鳳紝鍥犱負涓昏鏄拰Fortran姣旂瀛﹁綆楅熷害鏃舵墠鐢ㄣ傚凡緇忔湁浜虹紪鐮佹祴璇曚簡銆?br>鍙閫熷害錛屽鏋滃啀姣斿唴瀛橈紝鍏朵粬鍑犵璇█灝辨病鏈夊繀瑕佹瘮涓嬪幓浜嗐?br>

涓嶅悓璇█鐗堟湰鐨勪唬鐮佸埌鍘熶綔鑰呮彁渚涚殑鍦板潃鍘諱笅杞斤細http://files.cnblogs.com/miloyip/smallpt20100623.zip
涓嬮潰鏄祴璇曠敤鐨勭郴緇熼厤緗細

嫻嬭瘯閰嶇疆

  • 紜歡: Intel Core i7 920@2.67Ghz(4 core, HyperThread), 12GB RAM
  • 鎿嶄綔緋葷粺: Microsoft Windows 7 64-bit

嫻嬭瘯鍚嶇О

緙栬瘧鍣?/span>/瑙h瘧鍣?/span>

緙栬瘧/榪愯閫夐」

VC++

Visual C++ 2008 (32-bit)

/Ox /Ob2 /Oi /Ot /GL /FD /MD /GS- /Gy /arch:SSE /fp:fast

VC++_OpenMP

Visual C++ 2008 (32-bit)

/Ox /Ob2 /Oi /Ot /GL /FD /MD /GS- /Gy /arch:SSE /fp:fast /openmp

IC++

Intel C++ Compiler (32-bit)

/Ox /Og /Ob2 /Oi /Ot /Qipo /GA /MD /GS- /Gy /arch:SSE2 /fp:fast /Zi /QxHost

IC++_OpenMP

Intel C++ Compiler (32-bit)

/Ox /Og /Ob2 /Oi /Ot /Qipo /GA /MD /GS- /Gy /arch:SSE2 /fp:fast /Zi /QxHost /Qopenmp

GCC

GCC 4.3.4 in Cygwin (32-bit)

-O3 -march=native -ffast-math

GCC_OpenMP

GCC 4.3.4 in Cygwin (32-bit)

-O3 -march=native -ffast-math -fopenmp

C++/CLI

Visual C++ 2008 (32-bit), .Net Framework 3.5

/Ox /Ob2 /Oi /Ot /GL /FD /MD /GS- /fp:fast /Zi /clr /TP

C++/CLI_OpenMP

Visual C++ 2008 (32-bit), .Net Framework 3.5

/Ox /Ob2 /Oi /Ot /GL /FD /MD /GS- /fp:fast /Zi /clr /TP /openmp

C#

Visual C# 2008 (32-bit), .Net Framework 3.5

 

*C#_outref

Visual C# 2008 (32-bit), .Net Framework 3.5

 

F#

F# 2.0 (32-bit), .Net Framework 3.5

 

Java

Java SE 1.6.0_17

-server

JsChrome

Chrome 5.0.375.86

 

JsFirefox

Firefox 3.6

 

LuaJIT

LuaJIT 2.0.0-beta4 (32-bit)

 

Lua

LuaJIT (32-bit)

-joff

Python

Python 3.1.2 (32-bit)

 

*IronPython

IronPython 2.6 for .Net 4

 

*Jython

Jython 2.5.1

 

Ruby

Ruby 1.9.1p378

 

娓叉煋鐨勮В鍍忓害涓?/span>256x256錛屾瘡璞$礌浣?/span>100嬈¢噰鏍楓?/span>

緇撴灉鍙婂垎鏋?/span>

涓嬭〃涓璁劇殑鐩稿鏃墮棿浠ユ渶蹇殑鍗曠嚎紼嬫祴璇?/span>(IC++)浣滃熀鍑嗭紝鐢ㄩ紶鏍囨寜鍒楀彲鏀瑰彉鍩哄噯銆傜敱浜?/span>Ruby榪愯鏃墮棿澶暱錛屽彧姣忚薄绱犱綔4嬈¢噰鏍鳳紝鎶婃椂闂翠箻涓?/span>25銆傚彟 澶栵紝鍥犱負鍚勬祴璇曠殑娓叉煋鏃墮棿鐩稿樊寰堣繙錛屾墍浠ョ敤浜嗕袱涓褰㈠浘鍘繪樉紺烘暟鎹紝鍒嗗埆鏄劇ず鏃墮棿灝戜簬4000縐掑拰灝戜簬60縐掔殑嫻嬭瘯(Ruby鏄?/span>4000縐掍互澶栵紝涓嶄簣鏄?/span> 紺?/span>)銆?/span>

Test

Time(sec)

Relative time

IC++_OpenMP

2.861

0.19x

VC++_OpenMP

3.140

0.21x

GCC_OpenMP

3.359

0.23x

C++/CLI_OpenMP

5.147

0.35x

IC++

14.761

1.00x

VC++

17.632

1.19x

GCC

19.500

1.32x

C++/CLI

27.634

1.87x

Java

30.527

2.07x

C#_outref

44.220

3.00x

F#

47.172

3.20x

C#

48.194

3.26x

JsChrome

237.880

16.12x

LuaJIT

829.777

56.21x

Lua

1,227.656

83.17x

IronPython

2,921.573

197.93x

JsFirefox

3,588.778

243.13x

Python

3,920.556

265.60x

Jython

6,211.550

420.81x

Ruby

77,859.653

5,274.69x

C++/.Net/Java緇勫埆

闈欐佽璦鍜屽姩鎬佽璦鍦ㄦ嫻嬭瘯涓嬬殑鎬ц兘涓嶅湪鍚屼竴鏁伴噺綰с傚厛姣旇緝闈欐佽璦銆?/span>

C++鍜?/span>.Net鐨勬祴璇曠粨鏋滃拰涓婁竴綃囧崥鏂囩浉鑻ワ紝鑰?/span>C#鍜?/span>F#鏃犳樉钁楀尯鍒備絾鏄紝C++/CLI铏界劧鍚屾牱浜х敓IL錛屼簬鎷鐨?/span>.Net騫沖彴涓婃墽琛岋紝鍏舵覆鏌撴椂闂?/span> 鍗村彧鏄?/span>C#/F#鐨?/span>55%宸﹀彸銆備負浠涔堝憿錛熶嬌鐢?/span>ildasm鍘誨弽姹囩紪C++/CLI鍜?/span>C#鐨勫彲鎵ц鏂囦歡鍚庯紝鍙互鍙戠幇錛岀▼搴忕殑鐑偣鍑芥暟 Sphere.Intersect()鍦ㄤ袱涓増鏈腑錛?/span>C++/CLI鐗堟湰鐨勪唬鐮佸ぇ灝?/span>(code size)涓?/span>201瀛楄妭錛?/span> C#鍒欎負125瀛楄妭錛?/span> C++/CLI鐗堟湰鍦ㄧ紪璇戞椂錛屽凡鎶婂嚱鏁板唴鎵鏈?/span>Vec綾葷殑鏂規硶璋冪敤鍏ㄩ儴鍐呰仈錛岃?/span>C#鐗堟湰鍒欎嬌鐢?/span>callvirt璋冪敤Vec鐨勬柟娉曘備及璁?/span>JIT娌℃湁鎶婅繖鍑芥暟榪?/span> 琛屽唴鑱旓紝鍋氭垚榪欎釜鎬ц兘宸紓銆傚彟澶栵紝C++/CLI鐗堟湰浣跨敤浜嗗肩被鍨嬶紝騫朵嬌鐢ㄦ寚閽?/span>(浠g爜涓負寮曠敤)鎵樼浠g爜(C++/CLI)鐨勬覆鏌撴椂闂達紝浠呬負鍘熺敓闈炴嫭綆′唬鐮?/span>(IC++)鐨?/span>1.91鍊嶏紝涓漢瑙夊緱.Net鐨?/span>JIT宸茬粡闈炲父涓嶉敊銆?/span>

鍙︿竴鏂歸潰錛?/span>Java鐨勬ц兘琛ㄧ幇闈炲父紿佸嚭錛屽彧姣?/span>C++/CLI紼嶆參涓鐐癸紝Java鐗堟湰鐨勬覆鏌撴椂闂翠負C#/F#鐨?/span>65%宸﹀彸銆備互鍓嶄竴鐩磋涓猴紝C#涓嶅皯璁捐浼氫嬌鍏舵ц兘楂樹簬Java錛屼緥濡?/span>C#鐨勬柟娉曢璁句負闈炶櫄錛?/span>Java鍒欓璁句負铏氾紱鍙堜緥濡?/span>C#鏀寔struct浣滃肩被鍨?/span>(value type)錛?/span>Java鍒欏彧鏈?/span>class寮曠敤綾誨瀷(reference type)錛屽悗鑰呭繀欏諱嬌鐢?/span>GC銆備絾鏄紝榪欎釜嫻嬭瘯鏄劇ず錛?/span>Java VM搴旇鍦?/span>JIT涓仛浜嗗ぇ閲忎紭鍖栵紝浼拌涔熷簲鐢ㄤ簡鍐呰仈錛屾墠鑳戒嬌鍏舵ц兘閫艱繎C++/CLI銆?/span>

綰?/span>C++鏂歸潰錛?/span>Intel C++緙栬瘧鍣ㄦ渶蹇紝Visual C++鎱竴鐐圭偣(1.19x)錛?/span>GCC鍐嶆參涓鐐圭偣(1.32x)銆傝繖緇撴灉絎﹀悎鏈漢棰勬湡銆?/span> Intel C++鐨?/span>OpenMP鐗堟湰鍜屽崟綰跨▼姣旇緝錛岃揪5.16鍔犻熸瘮(speedup)錛屽浜?/span>4鏍?/span>Hyper Threading鏉ヨ綆楁槸涓嶉敊鐨勭粨鏋溿傝鑰呰嫢鏈夊叴瓚o紝涔熷彲浠ヨ嚜琛屾祴璇?/span>C# 4.0鐨勫茍琛屾柊鐗規с?/span>

鍔ㄦ佽璦緇勫埆

棣栧厛錛岃璇翠竴鍙ワ紝Google澶己浜嗭紝闅句互鎯沖儚JsChome鐨勬覆鏌撴椂闂翠粎鏄?/span>IC++鐨?/span>16.12鍊嶏紝C#鐨?/span>4.94鍊嶃?/span>

浠ヤ笅姣旇緝鍚勫姩鎬佽璦鐨勭浉瀵規椂闂達紝浠?/span>JsChrome涓哄熀鍑嗐?/span> Chrome鐨?/span>V8 JavaScript寮曟搸(1.00x)澶у箙鎶涚Firefox鐨?/span>SpiderMonkey寮曟搸(15.09x)銆傝?/span>LuaJIT(3.49x)鍜?/span>Lua(5.16x)鍒欐帓絎簩鍜岀涓夊悕銆?/span> Lua鐨?/span>JIT鐗堟湰鏄病鏈?/span>JIT鐨?/span>68%錛屽茍娌℃湁鎯沖儚涓殑蹇紝浣嗘槸涔熸瘮Python(16.48x)蹇緱澶氥傛浘鍚榪?/span>Ruby鏈夋晥鑳介棶棰橈紝娌℃兂鍒伴棶棰樼珶鐒跺姝や弗閲?/span>(327.31x)錛屽叾娓叉煋鏃墮棿宸笉澶氭槸Python鐨?/span>20鍊?




]]>
C#, C++, Java鎬ц兘瀵規瘮http://m.shnenglu.com/Chipset/archive/2009/03/01/75266.html灞卞縐戞妧灞卞縐戞妧Sun, 01 Mar 2009 14:22:00 GMThttp://m.shnenglu.com/Chipset/archive/2009/03/01/75266.htmlhttp://m.shnenglu.com/Chipset/comments/75266.htmlhttp://m.shnenglu.com/Chipset/archive/2009/03/01/75266.html#Feedback8http://m.shnenglu.com/Chipset/comments/commentRss/75266.htmlhttp://m.shnenglu.com/Chipset/services/trackbacks/75266.html鎽橀夎嚜Onur Gumus鐨勫崥瀹€?br>http://reverseblade.blogspot.com/2009/02/c-versus-c-versus-java-performance.html

C# vs C++ vs Java鎬ц兘瀵規瘮

C#, Java 鍜孋++瀵規瘮鎬ц兘甯稿父鏄紩鍙戜簤璁殑涓涓瘽棰樸傞偅浜涗笉鐔熸倝JIT鐨勪漢甯稿父澹扮ОJIT涓婅繍琛岀殑浠諱綍紼嬪簭璺烠++姣旈熷害閮戒笉琛屻傝岄偅浜涗嬌鐢↗ava鍜孋#鐨勪漢鍒? 甯稿父澹扮О鎬ц兘宸埆鐢氬皬錛屽嚑涔庡彲浠ュ拷鐣ヤ笉璁°傝繖閲屾湁涓涓祴璇曞姣旂粨鏋滃浘錛屾潵鑷猣reenode IRC鏈嶅姟鍣紝涓嶇煡閬撹皝嫻嬭瘯鐨勶紝浣嗘槸緇撴灉浼間箮寰堢湡瀹炪?nbsp;

瀵逛簬鎴戞潵璇達紝鍥犱負鎬ц兘鍘熷洜閫夋嫨C++浼間箮鐞嗙敱涓嶈凍銆傝浣忥細宸ョ▼甯堟瘮鏈嶅姟鍣ㄨ鏄傝吹鐨勫錛?br>

閮ㄥ垎鍏朵粬浜虹殑璇勮錛?br>
鍗曠嚎紼嬫祴璇曠殑錛屽綰跨▼濡備綍錛熷唴瀛樿楄垂澶氬皯錛熸祴璇曠▼搴忔暟鎹嬌鐢ㄧ殑璇█鍐呭緩綾誨瀷(姣斿int)榪樻槸鑷畾涔夌被鍨嬶紝濡傛灉璇█鏈韓鍐呭緩鐨勭被鍨嬮偅緙栬瘧鎴愪簩榪涘埗嫻嬭瘯鏃墮棿娑堣楀樊鍒笉浼氬澶ф槸姝e父鐨勩?br>PHP娌℃湁閽堝Windows緋葷粺浼樺寲錛屽洜姝ら熷害鑲畾涓婁笉鍘匯?br>鍦╓indows涓婃祴璇旿ava鏄惁榪愯鍦ㄨ櫄鎷熸満涓婏紵榛樿鎯呭喌鍙茍闈炲姝?璺烲inux鍙笉鍚?錛佸啀鑰咃紝嫻嬭瘯緇撴灉鑰楄垂鏃墮棿澶煭璇樊鐩稿鍙兘寰堝ぇ錛屽緢闅捐鏄庡疄闄呮儏褰€?br>
鏇村璇勮...

]]>
嫻嬭瘯CPU鍝佺墝鍜屽綋鍓嶅伐浣滈鐜?/title><link>http://m.shnenglu.com/Chipset/archive/2009/02/20/74402.html</link><dc:creator>灞卞縐戞妧</dc:creator><author>灞卞縐戞妧</author><pubDate>Fri, 20 Feb 2009 06:58:00 GMT</pubDate><guid>http://m.shnenglu.com/Chipset/archive/2009/02/20/74402.html</guid><wfw:comment>http://m.shnenglu.com/Chipset/comments/74402.html</wfw:comment><comments>http://m.shnenglu.com/Chipset/archive/2009/02/20/74402.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://m.shnenglu.com/Chipset/comments/commentRss/74402.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/Chipset/services/trackbacks/74402.html</trackback:ping><description><![CDATA[<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000;">榪欓噷鏈変竴孌甸潪甯哥畝鍗曠殑浠g爜錛屽彇鑷綉緇滐紝鎴戠◢鍔犱慨鏀癸紝璐村湪榪欓噷銆傜敤鏉ユ鏌PU鐨勭敓浜у晢鍜屽搧鐗岋紝浠ュ強褰撳墠宸ヤ綔棰戠巼錛屽鏋滄槸鍙板紡鏈篊PU錛岄鐜囧簲璇ユ亽瀹氾紝浣嗘槸縐誨姩鐗堟湰鐨凜PU錛岄鐜囦笉鍋滃湴鍦ㄥ彉銆備互涓嬩唬鐮佺敤Visual C</span><span style="color: #000000;">++</span><span style="color: #000000;">緙栬瘧錛屽洜涓哄唴宓屼竴鐐規眹緙栵紝閫犳垚縐繪鎬у彉宸?渚嬪錛欸CC姹囩紪璺烝T</span><span style="color: #000000;">&</span><span style="color: #000000;">T姹囩紪璇硶綾諱技錛屼絾鏄疢S姹囩紪璺烮ntel姹囩紪璇硶綾諱技)錛屼互涓嬩唬鐮佸鏋滃笇鏈涘湪MinGW(GCC)涓嬬紪璇戯紝闇瑕佷慨鏀歸偅鐐瑰唴宓岀殑姹囩紪銆?br><br>#include </span><span style="color: #000000;">"</span><span style="color: #000000;">stdafx.h</span><span style="color: #000000;">"</span><span style="color: #000000;"><br>#ifndef CPUID_HPP_<br></span><span style="color: #0000ff;">#define</span><span style="color: #000000;"> CPUID_HPP_</span><span style="color: #000000;"><br><br>#include </span><span style="color: #000000;"><</span><span style="color: #0000ff;">string</span><span style="color: #000000;">></span><span style="color: #000000;"><br>#include </span><span style="color: #000000;"><</span><span style="color: #000000;">cstring</span><span style="color: #000000;">></span><span style="color: #000000;"><br>#include </span><span style="color: #000000;"><</span><span style="color: #000000;">iostream</span><span style="color: #000000;">></span><span style="color: #000000;"><br>#include </span><span style="color: #000000;"><</span><span style="color: #000000;">windows.h</span><span style="color: #000000;">></span><span style="color: #000000;"><br><br>typedef unsigned </span><span style="color: #0000ff;">long</span><span style="color: #000000;"> DWORD;<br>typedef __int64 LONGLONG;<br><br></span><span style="color: #0000ff;">class</span><span style="color: #000000;"> CPUID<br>{<br></span><span style="color: #0000ff;">public</span><span style="color: #000000;">:<br>  CPUID() : m_eax(</span><span style="color: #000000;">0</span><span style="color: #000000;">), m_ebx(</span><span style="color: #000000;">0</span><span style="color: #000000;">), m_ecx(</span><span style="color: #000000;">0</span><span style="color: #000000;">), m_edx(</span><span style="color: #000000;">0</span><span style="color: #000000;">){}<br>  std::</span><span style="color: #0000ff;">string</span><span style="color: #000000;"> vendor(); </span><span style="color: #008000;">//</span><span style="color: #008000;">鍝釜鍘傚晢鍑虹殑錛烮ntel, AMD, VIA ?</span><span style="color: #008000;"><br></span><span style="color: #000000;">  std::</span><span style="color: #0000ff;">string</span><span style="color: #000000;"> name();   </span><span style="color: #008000;">//</span><span style="color: #008000;">榪欐槸CPU鐨勬暣浣撴弿榪?/span><span style="color: #008000;"><br></span><span style="color: #000000;">  LONGLONG frequency(DWORD stime </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #000000;">1000</span><span style="color: #000000;">);</span><span style="color: #008000;">//</span><span style="color: #008000;">CPU鐨勫綋鍓嶅伐浣滈鐜?/span><span style="color: #008000;"><br></span><span style="color: #000000;"><br></span><span style="color: #0000ff;">private</span><span style="color: #000000;">:<br>  </span><span style="color: #0000ff;">void</span><span style="color: #000000;">  Executecpuid(DWORD veax);<br>  LONGLONG cycles() </span><span style="color: #0000ff;">const</span><span style="color: #000000;"><br>  {<br>    DWORD h, l;         </span><span style="color: #008000;">//</span><span style="color: #008000;">涓嶈兘鐩存帴璇誨彇錛岀敤鍙橀噺榪囨浮涓涓?/span><span style="color: #008000;"><br></span><span style="color: #000000;">    __asm<br>    {<br>      rdtsc             </span><span style="color: #008000;">//</span><span style="color: #008000;">鎶婂綋鍓岰PU鍛ㄦ湡璇誨叆瀵勫瓨鍣?/span><span style="color: #008000;"><br></span><span style="color: #000000;">      mov l, eax<br>      mov h, edx<br>    }<br>    LONGLONG high </span><span style="color: #000000;">=</span><span style="color: #000000;"> h, low </span><span style="color: #000000;">=</span><span style="color: #000000;"> l;<br>    </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> high </span><span style="color: #000000;"><<</span><span style="color: #000000;"> </span><span style="color: #000000;">32</span><span style="color: #000000;"> </span><span style="color: #000000;">|</span><span style="color: #000000;"> low;<br>  }<br><br>  DWORD  m_eax;<br>  DWORD  m_ebx;<br>  DWORD  m_ecx;<br>  DWORD  m_edx;<br>};<br><br></span><span style="color: #0000ff;">void</span><span style="color: #000000;"> CPUID::Executecpuid(DWORD veax)<br>{<br>  DWORD deax;<br>  DWORD debx;<br>  DWORD decx;<br>  DWORD dedx;<br><br>  __asm<br>  {<br>    mov eax, veax<br>    cpuid<br>    mov deax, eax<br>    mov debx, ebx<br>    mov decx, ecx<br>    mov dedx, edx<br>  }<br><br>  m_eax </span><span style="color: #000000;">=</span><span style="color: #000000;"> deax;<br>  m_ebx </span><span style="color: #000000;">=</span><span style="color: #000000;"> debx;<br>  m_ecx </span><span style="color: #000000;">=</span><span style="color: #000000;"> decx;<br>  m_edx </span><span style="color: #000000;">=</span><span style="color: #000000;"> dedx;<br>}<br><br>std::</span><span style="color: #0000ff;">string</span><span style="color: #000000;"> CPUID::vendor()<br>{<br>  </span><span style="color: #0000ff;">const</span><span style="color: #000000;"> DWORD S </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000ff;">sizeof</span><span style="color: #000000;">(DWORD);<br>  </span><span style="color: #0000ff;">char</span><span style="color: #000000;"> cVID[S</span><span style="color: #000000;">*</span><span style="color: #000000;">3</span><span style="color: #000000;">+</span><span style="color: #000000;">1</span><span style="color: #000000;">];<br>  std::memset(cVID, </span><span style="color: #000000;">0</span><span style="color: #000000;">, </span><span style="color: #0000ff;">sizeof</span><span style="color: #000000;">(cVID));<br>  Executecpuid(</span><span style="color: #000000;">0</span><span style="color: #000000;">);<br>  std::memcpy(cVID</span><span style="color: #000000;">+</span><span style="color: #000000;">S</span><span style="color: #000000;">*</span><span style="color: #000000;">0</span><span style="color: #000000;">, </span><span style="color: #000000;">&</span><span style="color: #000000;">m_ebx, S);<br>  std::memcpy(cVID</span><span style="color: #000000;">+</span><span style="color: #000000;">S</span><span style="color: #000000;">*</span><span style="color: #000000;">1</span><span style="color: #000000;">, </span><span style="color: #000000;">&</span><span style="color: #000000;">m_edx, S);<br>  std::memcpy(cVID</span><span style="color: #000000;">+</span><span style="color: #000000;">S</span><span style="color: #000000;">*</span><span style="color: #000000;">2</span><span style="color: #000000;">, </span><span style="color: #000000;">&</span><span style="color: #000000;">m_ecx, S);<br><br>  </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> std::</span><span style="color: #0000ff;">string</span><span style="color: #000000;">(cVID);<br>}<br><br>std::</span><span style="color: #0000ff;">string</span><span style="color: #000000;"> CPUID::name()<br>{<br>  </span><span style="color: #0000ff;">const</span><span style="color: #000000;"> DWORD vendorID </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #000000;">0x80000002</span><span style="color: #000000;">;<br>  </span><span style="color: #0000ff;">const</span><span style="color: #000000;"> DWORD S </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000ff;">sizeof</span><span style="color: #000000;">(DWORD);<br>  </span><span style="color: #0000ff;">char</span><span style="color: #000000;"> cvendor[S</span><span style="color: #000000;">*</span><span style="color: #000000;">4</span><span style="color: #000000;">*</span><span style="color: #000000;">3</span><span style="color: #000000;">+</span><span style="color: #000000;">1</span><span style="color: #000000;">];<br>  std::memset(cvendor, </span><span style="color: #000000;">0</span><span style="color: #000000;">, </span><span style="color: #0000ff;">sizeof</span><span style="color: #000000;">(cvendor));<br><br>  </span><span style="color: #0000ff;">for</span><span style="color: #000000;">(DWORD i </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;">; i </span><span style="color: #000000;"><</span><span style="color: #000000;"> </span><span style="color: #000000;">3</span><span style="color: #000000;">; i</span><span style="color: #000000;">++</span><span style="color: #000000;">)<br>  {<br>    Executecpuid(vendorID </span><span style="color: #000000;">+</span><span style="color: #000000;"> i);<br>    </span><span style="color: #008000;">//</span><span style="color: #008000;"> 姣忔鎵ц緇撴潫鍚庯紝淇濆瓨鍥涗釜瀵勫瓨鍣ㄩ噷鐨刟scii鐮佸埌鏁扮粍</span><span style="color: #008000;"><br></span><span style="color: #000000;">    std::memcpy(cvendor </span><span style="color: #000000;">+</span><span style="color: #000000;"> i</span><span style="color: #000000;">*</span><span style="color: #000000;">S</span><span style="color: #000000;">*</span><span style="color: #000000;">4</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> S</span><span style="color: #000000;">*</span><span style="color: #000000;">0</span><span style="color: #000000;">, </span><span style="color: #000000;">&</span><span style="color: #000000;">m_eax, S);<br>    std::memcpy(cvendor </span><span style="color: #000000;">+</span><span style="color: #000000;"> i</span><span style="color: #000000;">*</span><span style="color: #000000;">S</span><span style="color: #000000;">*</span><span style="color: #000000;">4</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> S</span><span style="color: #000000;">*</span><span style="color: #000000;">1</span><span style="color: #000000;">, </span><span style="color: #000000;">&</span><span style="color: #000000;">m_ebx, S);<br>    std::memcpy(cvendor </span><span style="color: #000000;">+</span><span style="color: #000000;"> i</span><span style="color: #000000;">*</span><span style="color: #000000;">S</span><span style="color: #000000;">*</span><span style="color: #000000;">4</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> S</span><span style="color: #000000;">*</span><span style="color: #000000;">2</span><span style="color: #000000;">, </span><span style="color: #000000;">&</span><span style="color: #000000;">m_ecx, S);<br>    std::memcpy(cvendor </span><span style="color: #000000;">+</span><span style="color: #000000;"> i</span><span style="color: #000000;">*</span><span style="color: #000000;">S</span><span style="color: #000000;">*</span><span style="color: #000000;">4</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> S</span><span style="color: #000000;">*</span><span style="color: #000000;">3</span><span style="color: #000000;">, </span><span style="color: #000000;">&</span><span style="color: #000000;">m_edx, S);<br>  }<br>  </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> std::</span><span style="color: #0000ff;">string</span><span style="color: #000000;">(cvendor);<br>}<br><br>LONGLONG CPUID::frequency(DWORD stime)<br>{<br>  HANDLE hp </span><span style="color: #000000;">=</span><span style="color: #000000;"> GetCurrentProcess();<br>  HANDLE ht </span><span style="color: #000000;">=</span><span style="color: #000000;"> GetCurrentThread();<br><br>  DWORD pc </span><span style="color: #000000;">=</span><span style="color: #000000;"> GetPriorityClass(hp);<br>  DWORD tp </span><span style="color: #000000;">=</span><span style="color: #000000;"> GetThreadPriority(ht);<br><br>  BOOL flag1 </span><span style="color: #000000;">=</span><span style="color: #000000;"> FALSE, flag2 </span><span style="color: #000000;">=</span><span style="color: #000000;"> FALSE;<br><br>  flag1 </span><span style="color: #000000;">=</span><span style="color: #000000;"> SetPriorityClass(hp, REALTIME_PRIORITY_CLASS); </span><span style="color: #008000;">//</span><span style="color: #008000;">浼樺厛綰ц緗渶楂?/span><span style="color: #008000;"><br></span><span style="color: #000000;">  flag2 </span><span style="color: #000000;">=</span><span style="color: #000000;"> SetThreadPriority(ht, THREAD_PRIORITY_HIGHEST);</span><span style="color: #008000;">//</span><span style="color: #008000;">浼樺厛綰ц緗渶楂?br><br>  </span><span style="color: #008000;">//</span><span style="color: #008000;">鐢變簬CPU鏈韓鏃墮棿娉㈠姩杈冨ぇ錛屽洜姝ゆ椂闂翠粠緋葷粺璇誨彇錛岃繖鏍鋒瘮杈冨鉤鍧?/span><span style="color: #008000;"><br>  //鍛ㄦ湡闄や互鏃墮棿灝辨槸宸ヤ綔棰戠巼錛屽嵆鍗曚綅鏃墮棿鍐呯殑鍛ㄦ湡<br></span><span style="color: #000000;">  Sleep(stime);<br>  LARGE_INTEGER fq, st, ed;<br>  QueryPerformanceFrequency(</span><span style="color: #000000;">&</span><span style="color: #000000;">fq);<br>  QueryPerformanceCounter(</span><span style="color: #000000;">&</span><span style="color: #000000;">st);<br>  LONGLONG start </span><span style="color: #000000;">=</span><span style="color: #000000;"> cycles();<br>  Sleep(stime);<br>  QueryPerformanceCounter(</span><span style="color: #000000;">&</span><span style="color: #000000;">ed);<br>  LONGLONG end </span><span style="color: #000000;">=</span><span style="color: #000000;"> cycles();<br>  </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(flag1)<br>    SetPriorityClass(hp, pc);<br>  </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(flag2)<br>    SetThreadPriority(ht, tp);<br><br>  CloseHandle(hp);<br>  CloseHandle(ht);<br><br>  </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> (end </span><span style="color: #000000;">-</span><span style="color: #000000;"> start) </span><span style="color: #000000;">*</span><span style="color: #000000;"> fq.QuadPart </span><span style="color: #000000;">/</span><span style="color: #000000;"> (ed.QuadPart </span><span style="color: #000000;">-</span><span style="color: #000000;"> st.QuadPart);<br>}<br><br></span><span style="color: #0000ff;">#endif</span><span style="color: #000000;"><br><br><br>#include </span><span style="color: #000000;"><</span><span style="color: #000000;">cstdio</span><span style="color: #000000;">></span><span style="color: #000000;"><br>#include </span><span style="color: #000000;"><</span><span style="color: #000000;">cstdlib</span><span style="color: #000000;">></span><span style="color: #000000;"><br><br></span><span style="color: #0000ff;">int</span><span style="color: #000000;"> main()<br>{<br>  CPUID cpu;<br>  std::printf(</span><span style="color: #000000;">"</span><span style="color: #000000;">Vendor: %s\n</span><span style="color: #000000;">"</span><span style="color: #000000;">, cpu.vendor().c_str());<br>  std::printf(</span><span style="color: #000000;">"</span><span style="color: #000000;">Full name: %s\n</span><span style="color: #000000;">"</span><span style="color: #000000;">, cpu.name().c_str());<br>  </span><span style="color: #0000ff;">const</span><span style="color: #000000;"> unsigned TIMES </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #000000;">3</span><span style="color: #000000;">;<br>  std::printf(</span><span style="color: #000000;">"</span><span style="color: #000000;">Frequency(testing %d times): </span><span style="color: #000000;">"</span><span style="color: #000000;">, TIMES);<br>  </span><span style="color: #0000ff;">const</span><span style="color: #000000;"> </span><span style="color: #0000ff;">double</span><span style="color: #000000;"> UNIT </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #000000;">1000.0</span><span style="color: #000000;">;<br>  </span><span style="color: #0000ff;">for</span><span style="color: #000000;">(unsigned i </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;">; i </span><span style="color: #000000;"><</span><span style="color: #000000;"> TIMES; </span><span style="color: #000000;">++</span><span style="color: #000000;">i)<br>  {<br>    </span><span style="color: #0000ff;">double</span><span style="color: #000000;"> fre </span><span style="color: #000000;">=</span><span style="color: #000000;"> cpu.frequency() </span><span style="color: #000000;">/</span><span style="color: #000000;"> UNIT; </span><span style="color: #008000;">//</span><span style="color: #008000;"> 鍋囪CPU涓婚楂樹簬1000Hz</span><span style="color: #008000;"><br></span><span style="color: #000000;">    </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(fre </span><span style="color: #000000;">></span><span style="color: #000000;"> UNIT) <br>      fre </span><span style="color: #000000;">/=</span><span style="color: #000000;"> UNIT;<br>    std::printf(</span><span style="color: #000000;">"</span><span style="color: #000000;">%f%s </span><span style="color: #000000;">"</span><span style="color: #000000;">, fre, (fre </span><span style="color: #000000;">></span><span style="color: #000000;"> </span><span style="color: #000000;">10.0</span><span style="color: #000000;"> </span><span style="color: #000000;">?</span><span style="color: #000000;"> </span><span style="color: #000000;">"</span><span style="color: #000000;">MHz</span><span style="color: #000000;">"</span><span style="color: #000000;"> : </span><span style="color: #000000;">"</span><span style="color: #000000;">GHz</span><span style="color: #000000;">"</span><span style="color: #000000;">));<br>  }<br>  printf(</span><span style="color: #000000;">"</span><span style="color: #000000;">\n</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br>  std::system(</span><span style="color: #000000;">"</span><span style="color: #000000;">PAUSE</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br>  </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;">;<br>}</span></div> <br> <img src ="http://m.shnenglu.com/Chipset/aggbug/74402.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/Chipset/" target="_blank">灞卞縐戞妧</a> 2009-02-20 14:58 <a href="http://m.shnenglu.com/Chipset/archive/2009/02/20/74402.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Mersenne twister -- 鐩墠涓烘鏈濂界殑闅忔満鏁扮畻娉?/title><link>http://m.shnenglu.com/Chipset/archive/2009/01/19/72330.html</link><dc:creator>灞卞縐戞妧</dc:creator><author>灞卞縐戞妧</author><pubDate>Mon, 19 Jan 2009 10:58:00 GMT</pubDate><guid>http://m.shnenglu.com/Chipset/archive/2009/01/19/72330.html</guid><wfw:comment>http://m.shnenglu.com/Chipset/comments/72330.html</wfw:comment><comments>http://m.shnenglu.com/Chipset/archive/2009/01/19/72330.html#Feedback</comments><slash:comments>16</slash:comments><wfw:commentRss>http://m.shnenglu.com/Chipset/comments/commentRss/72330.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/Chipset/services/trackbacks/72330.html</trackback:ping><description><![CDATA[     鎽樿: v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} Normal 0 7.8 pt 0 2 false false false...  <a href='http://m.shnenglu.com/Chipset/archive/2009/01/19/72330.html'>闃呰鍏ㄦ枃</a><img src ="http://m.shnenglu.com/Chipset/aggbug/72330.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/Chipset/" target="_blank">灞卞縐戞妧</a> 2009-01-19 18:58 <a href="http://m.shnenglu.com/Chipset/archive/2009/01/19/72330.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>B鏍戙丅-鏍戙丅+鏍戙丅*鏍戦兘鏄粈涔?杞澆)http://m.shnenglu.com/Chipset/archive/2009/01/05/71265.html灞卞縐戞妧灞卞縐戞妧Mon, 05 Jan 2009 15:45:00 GMThttp://m.shnenglu.com/Chipset/archive/2009/01/05/71265.htmlhttp://m.shnenglu.com/Chipset/comments/71265.htmlhttp://m.shnenglu.com/Chipset/archive/2009/01/05/71265.html#Feedback0http://m.shnenglu.com/Chipset/comments/commentRss/71265.htmlhttp://m.shnenglu.com/Chipset/services/trackbacks/71265.html

B鏍?/span>

       鍗充簩鍙夋悳绱㈡爲錛?/span>

       1.鎵鏈夐潪鍙跺瓙緇撶偣鑷沖鎷ユ湁涓や釜鍎垮瓙錛?/span>Left鍜?/span>Right錛夛紱

       2.鎵鏈夌粨鐐瑰瓨鍌ㄤ竴涓叧閿瓧錛?/span>

       3.闈炲彾瀛愮粨鐐圭殑宸︽寚閽堟寚鍚戝皬浜庡叾鍏抽敭瀛楃殑瀛愭爲錛屽彸鎸囬拡鎸囧悜澶т簬鍏跺叧閿瓧鐨勫瓙鏍戯紱

       濡傦細

       

       B鏍戠殑鎼滅儲錛屼粠鏍圭粨鐐瑰紑濮嬶紝濡傛灉鏌ヨ鐨勫叧閿瓧涓庣粨鐐圭殑鍏抽敭瀛楃浉絳夛紝閭d箞灝卞懡涓紱鍚﹀垯錛屽鏋滄煡璇㈠叧閿瓧姣旂粨鐐瑰叧閿瓧灝忥紝灝辮繘鍏ュ乏鍎垮瓙錛涘鏋滄瘮緇撶偣鍏抽敭瀛楀ぇ錛屽氨榪涘叆鍙沖効瀛愶紱濡傛灉宸﹀効瀛愭垨鍙沖効瀛愮殑鎸囬拡涓虹┖錛屽垯鎶ュ憡鎵句笉鍒扮浉搴旂殑鍏抽敭瀛楋紱

       濡傛灉B鏍戠殑鎵鏈夐潪鍙跺瓙緇撶偣鐨勫乏鍙沖瓙鏍戠殑緇撶偣鏁扮洰鍧囦繚鎸佸樊涓嶅錛堝鉤琛★級錛岄偅涔?/span>B鏍戠殑鎼滅儲鎬ц兘閫艱繎浜屽垎鏌ユ壘錛涗絾瀹冩瘮榪炵畫鍐呭瓨絀洪棿鐨勪簩鍒嗘煡鎵劇殑浼樼偣鏄紝鏀瑰彉B鏍戠粨鏋勶紙鎻掑叆涓庡垹闄ょ粨鐐癸級涓嶉渶瑕佺Щ鍔ㄥぇ孌電殑鍐呭瓨鏁版嵁錛岀敋鑷抽氬父鏄父鏁板紑閿錛?/span> 

   浣?/span>B鏍戝湪緇忚繃澶氭鎻掑叆涓庡垹闄ゅ悗錛屾湁鍙兘瀵艱嚧涓嶅悓鐨勭粨鏋勶細

   鍙寵竟涔熸槸涓涓?/span>B鏍戯紝浣嗗畠鐨勬悳绱㈡ц兘宸茬粡鏄嚎鎬х殑浜嗭紱鍚屾牱鐨勫叧閿瓧闆嗗悎鏈夊彲鑳藉鑷翠笉鍚岀殑鏍戠粨鏋勭儲寮曪紱鎵浠ワ紝浣跨敤B鏍戣繕瑕佽冭檻灝藉彲鑳借B鏍戜繚鎸佸乏鍥劇殑緇撴瀯錛屽拰閬垮厤鍙沖浘鐨勭粨鏋勶紝涔熷氨鏄墍璋撶殑“騫寵 ”闂錛?/span>      

       瀹為檯浣跨敤鐨?/span>B鏍戦兘鏄湪鍘?/span>B鏍戠殑鍩虹涓婂姞涓婂鉤琛$畻娉曪紝鍗?#8220;騫寵 浜屽弶鏍?#8221;錛涘浣曚繚鎸?/span>B鏍戠粨鐐瑰垎甯冨潎鍖鐨勫鉤琛$畻娉曟槸騫寵 浜屽弶鏍戠殑鍏抽敭錛涘鉤琛$畻娉曟槸涓縐嶅湪B鏍戜腑鎻掑叆鍜屽垹闄ょ粨鐐圭殑絳栫暐錛?/span>

 

B-鏍?/span>

       鏄竴縐嶅璺悳绱㈡爲錛堝茍涓嶆槸浜屽弶鐨勶級錛?/span>

       1.瀹氫箟浠繪剰闈炲彾瀛愮粨鐐規渶澶氬彧鏈?/span>M涓効瀛愶紱涓?/span>M>2錛?/span>

       2.鏍圭粨鐐圭殑鍎垮瓙鏁頒負[2, M]錛?/span>

       3.闄ゆ牴緇撶偣浠ュ鐨勯潪鍙跺瓙緇撶偣鐨勫効瀛愭暟涓?/span>[M/2, M]錛?/span>

       4.姣忎釜緇撶偣瀛樻斁鑷沖皯M/2-1錛堝彇涓婃暣錛夊拰鑷沖M-1涓叧閿瓧錛涳紙鑷沖皯2涓叧閿瓧錛?/span>

       5.闈炲彾瀛愮粨鐐圭殑鍏抽敭瀛椾釜鏁?/span>=鎸囧悜鍎垮瓙鐨勬寚閽堜釜鏁?/span>-1錛?/span>

       6.闈炲彾瀛愮粨鐐圭殑鍏抽敭瀛楋細K[1], K[2], …, K[M-1]錛涗笖K[i] < K[i+1]錛?/span>

       7.闈炲彾瀛愮粨鐐圭殑鎸囬拡錛?/span>P[1], P[2], …, P[M]錛涘叾涓?/span>P[1]鎸囧悜鍏抽敭瀛楀皬浜?/span>K[1]鐨勫瓙鏍戯紝P[M]鎸囧悜鍏抽敭瀛楀ぇ浜?/span>K[M-1]鐨勫瓙鏍戯紝鍏跺畠P[i]鎸囧悜鍏抽敭瀛楀睘浜?/span>(K[i-1], K[i])鐨勫瓙鏍戯紱

       8.鎵鏈夊彾瀛愮粨鐐逛綅浜庡悓涓灞傦紱

       濡傦細錛?/span>M=3錛?/span>

       B-鏍戠殑鎼滅儲錛屼粠鏍圭粨鐐瑰紑濮嬶紝瀵圭粨鐐瑰唴鐨勫叧閿瓧錛堟湁搴忥級搴忓垪榪涜浜屽垎鏌ユ壘錛屽鏋滃懡涓垯緇撴潫錛屽惁鍒欒繘鍏ユ煡璇㈠叧閿瓧鎵灞炶寖鍥寸殑鍎垮瓙緇撶偣錛涢噸澶嶏紝鐩村埌鎵瀵瑰簲鐨勫効瀛愭寚閽堜負絀猴紝鎴栧凡緇忔槸鍙跺瓙緇撶偣錛?/span>

B-鏍戠殑鐗規э細

       1.鍏抽敭瀛楅泦鍚堝垎甯冨湪鏁撮鏍戜腑錛?/span>

       2.浠諱綍涓涓叧閿瓧鍑虹幇涓斿彧鍑虹幇鍦ㄤ竴涓粨鐐逛腑錛?/span>

       3.鎼滅儲鏈夊彲鑳藉湪闈炲彾瀛愮粨鐐圭粨鏉燂紱

       4.鍏舵悳绱㈡ц兘絳変環浜庡湪鍏抽敭瀛楀叏闆嗗唴鍋氫竴嬈′簩鍒嗘煡鎵撅紱

       5.鑷姩灞傛鎺у埗錛?/span>

       鐢變簬闄愬埗浜嗛櫎鏍圭粨鐐逛互澶栫殑闈炲彾瀛愮粨鐐癸紝鑷沖皯鍚湁M/2涓効瀛愶紝紜繚浜嗙粨鐐圭殑鑷沖皯鍒╃敤鐜囷紝鍏舵渶搴曟悳绱㈡ц兘涓猴細

    

       鍏朵腑錛?/span>M涓鴻瀹氱殑闈炲彾瀛愮粨鐐規渶澶氬瓙鏍戜釜鏁幫紝N涓哄叧閿瓧鎬繪暟錛?/span>

       鎵浠?/span>B-鏍戠殑鎬ц兘鎬繪槸絳変環浜庝簩鍒嗘煡鎵撅紙涓?/span>M鍊兼棤鍏籌級錛屼篃灝辨病鏈?/span>B鏍戝鉤琛$殑闂錛?/span>

       鐢變簬M/2鐨勯檺鍒訛紝鍦ㄦ彃鍏ョ粨鐐規椂錛屽鏋滅粨鐐瑰凡婊★紝闇瑕佸皢緇撶偣鍒嗚涓轟袱涓悇鍗?/span>M/2鐨勭粨鐐癸紱鍒犻櫎緇撶偣鏃訛紝闇灝嗕袱涓笉瓚?/span>M/2鐨勫厔寮熺粨鐐瑰悎騫訛紱

 

B+鏍?/span>

       B+鏍戞槸B-鏍戠殑鍙樹綋錛屼篃鏄竴縐嶅璺悳绱㈡爲錛?/span>

       1.鍏跺畾涔夊熀鏈笌B-鏍戝悓錛岄櫎浜嗭細

       2.闈炲彾瀛愮粨鐐圭殑瀛愭爲鎸囬拡涓庡叧閿瓧涓暟鐩稿悓錛?/span>

       3.闈炲彾瀛愮粨鐐圭殑瀛愭爲鎸囬拡P[i]錛屾寚鍚戝叧閿瓧鍊煎睘浜?/span>[K[i], K[i+1])鐨勫瓙鏍戯紙B-鏍戞槸寮鍖洪棿錛夛紱

       5.涓烘墍鏈夊彾瀛愮粨鐐瑰鍔犱竴涓摼鎸囬拡錛?/span>

       6.鎵鏈夊叧閿瓧閮藉湪鍙跺瓙緇撶偣鍑虹幇錛?/span>

       濡傦細錛?/span>M=3錛?/span>

   B+鐨勬悳绱笌B-鏍戜篃鍩烘湰鐩稿悓錛屽尯鍒槸B+鏍戝彧鏈夎揪鍒板彾瀛愮粨鐐規墠鍛戒腑錛?/span>B-鏍戝彲浠ュ湪闈炲彾瀛愮粨鐐瑰懡涓級錛屽叾鎬ц兘涔熺瓑浠蜂簬鍦ㄥ叧閿瓧鍏ㄩ泦鍋氫竴嬈′簩鍒嗘煡鎵撅紱

       B+鐨勭壒鎬э細

       1.鎵鏈夊叧閿瓧閮藉嚭鐜板湪鍙跺瓙緇撶偣鐨勯摼琛ㄤ腑錛堢瀵嗙儲寮曪級錛屼笖閾捐〃涓殑鍏抽敭瀛楁伆濂芥槸鏈夊簭鐨勶紱

       2.涓嶅彲鑳藉湪闈炲彾瀛愮粨鐐瑰懡涓紱

       3.闈炲彾瀛愮粨鐐圭浉褰撲簬鏄彾瀛愮粨鐐圭殑绱㈠紩錛堢█鐤忕儲寮曪級錛屽彾瀛愮粨鐐圭浉褰撲簬鏄瓨鍌紙鍏抽敭瀛楋級鏁版嵁鐨勬暟鎹眰錛?/span>

       4.鏇撮傚悎鏂囦歡绱㈠紩緋葷粺錛?/span>

  

B*鏍?/span>

       鏄?/span>B+鏍戠殑鍙樹綋錛屽湪B+鏍戠殑闈炴牴鍜岄潪鍙跺瓙緇撶偣鍐嶅鍔犳寚鍚戝厔寮熺殑鎸囬拡錛?/span>

   B*鏍戝畾涔変簡闈炲彾瀛愮粨鐐瑰叧閿瓧涓暟鑷沖皯涓?/span>(2/3)*M錛屽嵆鍧楃殑鏈浣庝嬌鐢ㄧ巼涓?/span>2/3錛堜唬鏇?/span>B+鏍戠殑1/2錛夛紱

       B+鏍戠殑鍒嗚錛氬綋涓涓粨鐐規弧鏃訛紝鍒嗛厤涓涓柊鐨勭粨鐐癸紝騫跺皢鍘熺粨鐐逛腑1/2鐨勬暟鎹鍒跺埌鏂扮粨鐐癸紝鏈鍚庡湪鐖剁粨鐐逛腑澧炲姞鏂扮粨鐐圭殑鎸囬拡錛?/span>B+鏍戠殑鍒嗚鍙獎鍝嶅師緇撶偣鍜岀埗緇撶偣錛岃屼笉浼氬獎鍝嶅厔寮熺粨鐐癸紝鎵浠ュ畠涓嶉渶瑕佹寚鍚戝厔寮熺殑鎸囬拡錛?/span>

       B*鏍戠殑鍒嗚錛氬綋涓涓粨鐐規弧鏃訛紝濡傛灉瀹冪殑涓嬩竴涓厔寮熺粨鐐規湭婊★紝閭d箞灝嗕竴閮ㄥ垎鏁版嵁縐誨埌鍏勫紵緇撶偣涓紝鍐嶅湪鍘熺粨鐐規彃鍏ュ叧閿瓧錛屾渶鍚庝慨鏀圭埗緇撶偣涓厔寮熺粨鐐圭殑鍏抽敭瀛楋紙鍥犱負鍏勫紵緇撶偣鐨勫叧閿瓧鑼冨洿鏀瑰彉浜嗭級錛涘鏋滃厔寮熶篃婊′簡錛屽垯鍦ㄥ師緇撶偣涓庡厔寮熺粨鐐逛箣闂村鍔犳柊緇撶偣錛屽茍鍚勫鍒?/span>1/3鐨勬暟鎹埌鏂扮粨鐐癸紝鏈鍚庡湪鐖剁粨鐐瑰鍔犳柊緇撶偣鐨勬寚閽堬紱

       鎵浠ワ紝B*鏍戝垎閰嶆柊緇撶偣鐨勬鐜囨瘮B+鏍戣浣庯紝絀洪棿浣跨敤鐜囨洿楂橈紱

  

灝忕粨

       B鏍戯細浜屽弶鏍戯紝姣忎釜緇撶偣鍙瓨鍌ㄤ竴涓叧閿瓧錛岀瓑浜庡垯鍛戒腑錛屽皬浜庤蛋宸︾粨鐐癸紝澶т簬璧板彸緇撶偣錛?/span>

       B-鏍戯細澶氳礬鎼滅儲鏍戯紝姣忎釜緇撶偣瀛樺偍M/2鍒?/span>M涓叧閿瓧錛岄潪鍙跺瓙緇撶偣瀛樺偍鎸囧悜鍏抽敭瀛楄寖鍥寸殑瀛愮粨鐐癸紱

       鎵鏈夊叧閿瓧鍦ㄦ暣棰楁爲涓嚭鐜幫紝涓斿彧鍑虹幇涓嬈★紝闈炲彾瀛愮粨鐐瑰彲浠ュ懡涓紱

       B+鏍戯細鍦?/span>B-鏍戝熀紜涓婏紝涓哄彾瀛愮粨鐐瑰鍔犻摼琛ㄦ寚閽堬紝鎵鏈夊叧閿瓧閮藉湪鍙跺瓙緇撶偣涓嚭鐜幫紝闈炲彾瀛愮粨鐐逛綔涓哄彾瀛愮粨鐐圭殑绱㈠紩錛?/span>B+鏍戞繪槸鍒板彾瀛愮粨鐐規墠鍛戒腑錛?/span>

       B*鏍戯細鍦?/span>B+鏍戝熀紜涓婏紝涓洪潪鍙跺瓙緇撶偣涔熷鍔犻摼琛ㄦ寚閽堬紝灝嗙粨鐐圭殑鏈浣庡埄鐢ㄧ巼浠?/span>1/2鎻愰珮鍒?/span>2/3銆?/span>

杞嚜: http://blog.csdn.net/manesking/archive/2007/02/09/1505979.aspx



]]>
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            好吊色欧美一区二区三区视频| 久久久久久久高潮| 欧美一二三区在线观看| 亚洲影院色在线观看免费| 亚洲作爱视频| 午夜精品电影| 欧美伊人久久久久久久久影院| 亚洲欧美日韩在线| 久久久久久日产精品| 久久综合九色综合久99| 蜜臀久久99精品久久久久久9 | 国产精品无码永久免费888| 国产精品午夜春色av| 韩国v欧美v日本v亚洲v| 亚洲精品欧美精品| 亚洲欧美日韩一区二区三区在线观看 | 午夜精彩视频在线观看不卡 | 在线视频观看日韩| 日韩一区二区久久| 校园春色国产精品| 欧美成年人视频| 999在线观看精品免费不卡网站| 国产日韩欧美亚洲一区| 午夜亚洲福利| 裸体一区二区三区| 欧美天堂亚洲电影院在线观看| 国产精品久久久久久妇女6080 | 久久视频在线视频| 亚洲人成绝费网站色www| av成人老司机| 久久影院午夜论| 国产精品国产馆在线真实露脸| 娇妻被交换粗又大又硬视频欧美| 99精品99久久久久久宅男| 久久久福利视频| 亚洲美女区一区| 美女主播视频一区| 国产欧美日韩中文字幕在线| 91久久国产综合久久| 欧美专区中文字幕| 亚洲精品一区中文| 麻豆精品一区二区av白丝在线| 国产精品美女午夜av| 亚洲另类在线视频| 蜜臀99久久精品久久久久久软件| 亚洲一区二区精品视频| 欧美日本精品在线| 亚洲韩国青草视频| 噜噜噜噜噜久久久久久91| 亚洲免费一在线| 国产精品99免视看9| 夜夜夜久久久| 亚洲激情一区二区三区| 免费美女久久99| 在线看片日韩| 免费av成人在线| 久久精品伊人| 黄网动漫久久久| 久久久99爱| 亚洲欧美日本另类| 国产精品一卡| 性亚洲最疯狂xxxx高清| 一区二区三区视频免费在线观看| 欧美区在线播放| 一区二区三区色| 99国内精品久久久久久久软件| 欧美激情视频一区二区三区免费 | 美女视频网站黄色亚洲| 欧美在线观看视频在线 | 国产精品国产三级国产普通话99| 一级日韩一区在线观看| 欧美日本亚洲| 亚洲丝袜av一区| 99这里有精品| 国产精品进线69影院| 亚洲夜间福利| 亚洲欧美国产精品专区久久| 国产精品一区三区| 久久狠狠亚洲综合| 久久理论片午夜琪琪电影网| 亚洲国产精品传媒在线观看| 欧美激情一区二区三区四区| 欧美高清视频一区| 亚洲视频一区在线| 亚洲一区二区精品| 激情五月婷婷综合| 亚洲娇小video精品| 欧美午夜不卡| 欧美在线视频导航| 久久免费国产精品1| 亚洲毛片在线看| 一区二区三区视频在线| 国产日韩亚洲欧美| 亚洲盗摄视频| 欧美午夜久久久| 久久综合狠狠综合久久激情| 欧美成人亚洲| 久久久99免费视频| 欧美日韩免费视频| 久久这里有精品视频| 欧美电影在线观看| 久久久精品久久久久| 欧美另类在线观看| 久久女同精品一区二区| 欧美日韩一区在线播放| 久久只有精品| 国产精品久久久久久妇女6080| 免费观看亚洲视频大全| 国产精品久久网| 亚洲动漫精品| 国产日韩在线看片| 一区二区不卡在线视频 午夜欧美不卡在| 国产日韩一区二区三区在线播放| 亚洲高清视频一区| 国产亚洲精品一区二区| 日韩午夜免费视频| 亚洲黄色影院| 久久国产精品99国产| 亚洲欧美日韩在线一区| 欧美国产精品专区| 美女脱光内衣内裤视频久久影院 | 亚洲欧美日韩在线一区| 亚洲精品孕妇| 久久久噜噜噜| 久久久久国产精品一区三寸| 欧美午夜精品久久久久久孕妇| 欧美大片在线观看| 精品二区视频| 欧美一级片久久久久久久| 亚洲国产99精品国自产| 日韩视频在线观看| 久久只精品国产| 欧美影院在线播放| 国产精品v欧美精品v日韩| 最新中文字幕一区二区三区| 亚洲成人在线视频播放| 欧美主播一区二区三区| 久久精品91久久久久久再现| 欧美午夜不卡| 在线视频欧美一区| 亚洲午夜三级在线| 欧美日韩精品二区第二页| 亚洲三级影片| 亚洲天堂成人| 国产精品久久久久婷婷| 99精品国产福利在线观看免费| 亚洲伦伦在线| 欧美日韩中文字幕| 亚洲欧美www| 麻豆精品一区二区综合av| 亚洲动漫精品| 欧美日韩成人激情| 亚洲一区在线免费观看| 久久国产精品久久久久久久久久| 国产综合色在线| 久久综合色影院| 亚洲精品美女久久久久| 亚洲图片在线观看| 国产亚洲精品bt天堂精选| 久久青草福利网站| 亚洲电影免费观看高清| 一区二区三区欧美激情| 国产精品v欧美精品v日韩 | 欧美va天堂在线| 亚洲黄色精品| 亚洲欧美日韩一区二区三区在线观看 | 在线亚洲激情| 久久漫画官网| 日韩亚洲在线| 国产欧美一区二区三区久久| 久久se精品一区精品二区| 亚洲二区在线观看| 欧美影院视频| 亚洲精品一区二区在线| 国产精品毛片a∨一区二区三区|国| 午夜免费久久久久| 亚洲高清色综合| 久久av一区| 一区二区三区精品视频| 在线播放亚洲| 国产精品久久久久久久久免费桃花 | 免费一级欧美在线大片| 亚洲精品孕妇| 韩日视频一区| 欧美性开放视频| 欧美高清不卡在线| 欧美专区在线观看一区| 日韩视频免费在线| 麻豆精品在线视频| 性欧美xxxx视频在线观看| 亚洲精品国产系列| 亚洲精品看片| 亚久久调教视频| 999亚洲国产精| 一区免费在线| 国产欧美日韩综合一区在线播放| 欧美日本一区二区视频在线观看| 欧美中文字幕在线播放| 亚洲欧美在线免费| 在线综合+亚洲+欧美中文字幕|