{"id":251,"date":"2022-08-30T14:58:14","date_gmt":"2022-08-30T14:58:14","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/08\/31\/problem-about-shift-record-and-share-programming-errors\/"},"modified":"2022-08-30T14:58:14","modified_gmt":"2022-08-30T14:58:14","slug":"problem-about-shift-record-and-share-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/problem-about-shift-record-and-share-programming-errors\/","title":{"rendered":"problem about shift-Record and share programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/341965dd550b3ef03ed8d77e41a7b3be?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nuser1142769<br \/>\nc optimization gcc bitwise shift<br \/>\nI&#8217;m seeing behaviour I don&#8217;t expect when compiling this code with different optimization levels in gcc.The function test should fill a 64 bit unsigned integer with ones, shift them shift_size bits to the left, and return the 32 low bits as a 32 bit unsigned integer.When I compile with -O0 I get the results I expect.When I compile with -O2 I do n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/cbda2309e19850795f078c04ba58570f?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAustin Truong<br \/>\nc bitwise shift<br \/>\nWhy do I get such a big i<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/cc7bcfcdb79be3371062ad4da7a81afc?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nnullArray<br \/>\nc++ c shift<br \/>\nHow exactly do I do this in C\/C++? Let&#8217;s say I want t<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/09a0a4dbad81490b957708c0f390c612?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nCheeseConQueso<br \/>\nregex perl variables shift<br \/>\nThis code works &#8211; It takes an array of full txt file paths and strips them so that when $exam_nums[$x] is called, it returns the file namefor (0..$#exam_nums) {$exam_nums[$_] =~ s\/\\.txt$\/\/; #remove extension$<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/a140dcb923b5f26469018ca7d764fd30?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nretep998<br \/>\nc++ 64bit bitwise shift<br \/>\nPossible Duplicate:64bit shift problem I&#8217;m using Visual Studio 2012 on Windows 8 64-bit, targeting x64 in debug mode, using an AMD Phenom II. So Basica<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/3aaeaf7d29d09e618c63bd80491d3cc5?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\ntalkaboutquality<br \/>\nc shift signedness operand<br \/>\nNote: This question is all about the signedness of the second operand of bit shift operators &gt;. Not at all about the first operand.CERT INT34-C, in part: Do not shift a negative number of bits &#8230;Not that it needed justification, but they justify sa<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/2a04086d7656ac97e09c20c4fe4d8266?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nsharptooth<br \/>\nc++ language-lawyer shift<br \/>\nAccording to C++03, 5.8\/2, left-shifting is defined as follows:The value of E1<\/li>\n<\/ul>\n<p id=\"rop\"><small>Originally posted 2013-08-31 06:23:03. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>user1142769 c optimization gcc bitwise shift I&#8217;m seeing behaviour I don&#8217;t expect when compiling this code with different optimization levels in gcc.The function test should fill a 64 bit unsigned integer with ones, shift them shift_size bits to the left, and return the 32 low bits as a 32 bit unsigned integer.When I compile with [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-251","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/251","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=251"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/251\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=251"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=251"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=251"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}