{"id":3451,"date":"2005-04-27T18:30:02","date_gmt":"2005-04-27T18:30:02","guid":{"rendered":"http:\/\/warrenmyers.com\/blog\/?p=15"},"modified":"2005-04-27T18:30:02","modified_gmt":"2005-04-27T18:30:02","slug":"a-way-around-the-rotational-issue","status":"publish","type":"post","link":"https:\/\/merikebi.warrenmyers.com\/?p=3451","title":{"rendered":"A way around the rotational issue"},"content":{"rendered":"<p>Haha! My roommate pointed out on Saturday that a bit-wise rotation is just like shifting a value X bits, and or-ing it with the same value shifted the opposite direction (word size)-X bits. For example: <code> A = (A &lt;&lt; 7) | (a &gt;&gt; 25)<\/code> for a 32-bit variable. This means I can, in fact, perform really big variable shifting using a source array and a temporary holding variable for the first entry. See the following for an example of rotating a 96-bit value 3 bits left (3 32-bit entries): <code>h = A[0]; A[0] = (A[0] &lt;&lt; 3) | (A[1] &gt;&gt; 29); A[1] = (A[1] &lt;&lt; 3) | (A[2] &gt;&gt; 29); A[2] = (A[2 &lt;&lt; 3) | (h &gt;&gt; 29)<\/code>.<\/p>\n<p>It&#8217;s a bit confusing at first blush, but it works, and it&#8217;s extensible to any size chunks you want to rotate. And it doesn&#8217;t have the overhead of an additional 2(N-bit) operations to expand and compress the value into a &#8216;real&#8217; array first.<\/p>\n<p>This means that I can also code my Wolf0 algorithm, the first one I&#8217;d come up with, without realizing too much of a performance hit.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Haha! My roommate pointed out on Saturday that a bit-wise rotation is just like shifting a value X bits, and or-ing it with the same value shifted the opposite direction (word size)-X bits. For example: A = (A &lt;&lt; 7) | (a &gt;&gt; 25) for a 32-bit variable. This means I can, in fact, perform &hellip;<br \/><a href=\"https:\/\/merikebi.warrenmyers.com\/?p=3451\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\">Continue reading <span class=\"screen-reader-text\">A way around the rotational issue<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[41],"tags":[],"keyring_services":[],"class_list":["post-3451","post","type-post","status-publish","format-standard","hentry","category-technical"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/3451","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3451"}],"version-history":[{"count":0,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/3451\/revisions"}],"wp:attachment":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3451"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3451"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3451"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fkeyring_services&post=3451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}