{"id":807,"date":"2018-05-09T11:31:05","date_gmt":"2018-05-09T11:31:05","guid":{"rendered":"https:\/\/ibex.tech\/c\/?p=807"},"modified":"2022-02-17T10:13:11","modified_gmt":"2022-02-17T10:13:11","slug":"twos-compliment","status":"publish","type":"post","link":"https:\/\/ibex.tech\/c\/c\/maths\/twos-compliment","title":{"rendered":"Two&#8217;s compliment \/ 2&#8217;s compliment"},"content":{"rendered":"\n<p>Two&#8217;s complement is the way most computers represent integers.\u00a0 The highest bit indicates positive or negative: <\/p>\n\n\n\n<p>0b0xxxxxxx = value is positive or zero <\/p>\n\n\n\n<p>0b1xxxxxxx = value is negative <\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Convert positive value to negative <\/h5>\n\n\n\n<p>Invert the binary digits and add one to the result. <\/p>\n\n\n\n<p>E.g. 1 \/ 0x01 becomes 0xFE, +1 = 0xFF <\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Convert negative value to positive <\/h5>\n\n\n\n<p>Invert the binary digits and add one to the result. <\/p>\n\n\n\n<p>e.g. -1 \/ 0xFF\u00a0\u00a0becomes 0x00, +1 = 0x01 <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Good resources<br> <\/h4>\n\n\n\n<p><a href=\"https:\/\/www.cs.cornell.edu\/~tomf\/notes\/cps104\/twoscomp.html\">https:\/\/www.cs.cornell.edu\/~tomf\/notes\/cps104\/twoscomp.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Two&#8217;s complement is the way most computers represent integers.\u00a0 The highest bit indicates positive or negative: 0b0xxxxxxx = value is positive or zero 0b1xxxxxxx = value is negative Convert positive value to negative Invert the binary digits and add one to the result. E.g. 1 \/ 0x01 becomes 0xFE, +1 = 0xFF Convert negative value [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-807","post","type-post","status-publish","format-standard","hentry","category-maths"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/posts\/807","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/comments?post=807"}],"version-history":[{"count":2,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/posts\/807\/revisions"}],"predecessor-version":[{"id":959,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/posts\/807\/revisions\/959"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/media?parent=807"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/categories?post=807"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/tags?post=807"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}