{"id":20,"date":"2006-08-02T01:56:20","date_gmt":"2006-08-02T09:56:20","guid":{"rendered":"http:\/\/www.pagetable.com\/?p=20"},"modified":"2006-08-02T01:56:20","modified_gmt":"2006-08-02T09:56:20","slug":"arithmetic-mean-of-two-signed-integers","status":"publish","type":"post","link":"https:\/\/www.pagetable.com\/?p=20","title":{"rendered":"Arithmetic mean of two signed integers"},"content":{"rendered":"<p>It&#8217;s time for a puzzle again! (submitted by <a href=\"http:\/\/www.black-sheep-software.de\/bernhard\/\">sheepmaster<\/a>)<\/p>\n<p>Calculate in x86 assembly language the arithmetic mean (a+b)\/2 of two signed integers a and b. If you think this is trivial, consider the following edge cases: a = b = 0x7FFFFFFF and a = 0x7FFFFFFF, b = 0x80000000.<\/p>\n<p>Again, the standard rules apply: a and b are in general purpose registers of your choice, the result can be in any register, and any register can be overwritten.<\/p>\n<p>Oh, and by the way, using larger data types isn&#8217;t allowed either (that would make things too easy, wouldn&#8217;t it?).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s time for a puzzle again! (submitted by sheepmaster) Calculate in x86 assembly language the arithmetic mean (a+b)\/2 of two signed integers a and b. If you think this is trivial, consider the following edge cases: a = b = 0x7FFFFFFF and a = 0x7FFFFFFF, b = 0x80000000. Again, the standard rules apply: a and &#8230; <a title=\"Arithmetic mean of two signed integers\" class=\"read-more\" href=\"https:\/\/www.pagetable.com\/?p=20\" aria-label=\"Read more about Arithmetic mean of two signed integers\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-20","post","type-post","status-publish","format-standard","hentry","category-puzzle"],"_links":{"self":[{"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/posts\/20","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=20"}],"version-history":[{"count":0,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/posts\/20\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=20"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=20"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=20"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}