<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mojopuzzler.org/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Integer_byte_encoding_peculiarity</id>
	<title>Integer byte encoding peculiarity - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mojopuzzler.org/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Integer_byte_encoding_peculiarity"/>
	<link rel="alternate" type="text/html" href="https://mojopuzzler.org/mediawiki/index.php?title=Integer_byte_encoding_peculiarity&amp;action=history"/>
	<updated>2026-05-13T10:26:12Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.40.1</generator>
	<entry>
		<id>https://mojopuzzler.org/mediawiki/index.php?title=Integer_byte_encoding_peculiarity&amp;diff=2268&amp;oldid=prev</id>
		<title>Gneale: Created page with &quot;===== Return to: Chialisp =====  According to Matt Howard 20210816, there is a &quot;peculiarity with how integers are encoded in bytes.    It's signed integers.    If you just return &lt;code&gt;run '(q . 0xd7)'&lt;/code&gt; you get -41 because the most significant bit is set and that's telling the interpreter to read this as a negative number.    If you add some leading zeroes &lt;code&gt;run '(q . 0x00d7)'&lt;/code&gt;, it should pop out as you would expect&quot;.   Returns 215.  &lt;h1&gt;Orig...&quot;</title>
		<link rel="alternate" type="text/html" href="https://mojopuzzler.org/mediawiki/index.php?title=Integer_byte_encoding_peculiarity&amp;diff=2268&amp;oldid=prev"/>
		<updated>2023-11-17T15:56:34Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;===== Return to: &lt;a href=&quot;/mediawiki/index.php/Chialisp&quot; title=&quot;Chialisp&quot;&gt;Chialisp&lt;/a&gt; =====  According to Matt Howard 20210816, there is a &amp;quot;peculiarity with how integers are encoded in bytes.    It&amp;#039;s signed integers.    If you just return &amp;lt;code&amp;gt;run &amp;#039;(q . 0xd7)&amp;#039;&amp;lt;/code&amp;gt; you get -41 because the most significant bit is set and that&amp;#039;s telling the interpreter to read this as a negative number.    If you add some leading zeroes &amp;lt;code&amp;gt;run &amp;#039;(q . 0x00d7)&amp;#039;&amp;lt;/code&amp;gt;, it should pop out as you would expect&amp;quot;.   Returns 215.  &amp;lt;h1&amp;gt;Orig...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;===== Return to: [[Chialisp|Chialisp]] =====&lt;br /&gt;
&lt;br /&gt;
According to Matt Howard 20210816, there is a &amp;quot;peculiarity with how integers are encoded in bytes.  &lt;br /&gt;
&lt;br /&gt;
It's signed integers.  &lt;br /&gt;
&lt;br /&gt;
If you just return &amp;lt;code&amp;gt;run '(q . 0xd7)'&amp;lt;/code&amp;gt; you get -41 because the most significant bit is set and that's telling the interpreter to read this as a negative number.  &lt;br /&gt;
&lt;br /&gt;
If you add some leading zeroes &amp;lt;code&amp;gt;run '(q . 0x00d7)'&amp;lt;/code&amp;gt;, it should pop out as you would expect&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
Returns 215.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Original concern&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Q: I still have one question: why does &amp;lt;code&amp;gt;brun '(- (q . 0xd7) (q . 0x1))'&amp;lt;/code&amp;gt; return -42?&lt;br /&gt;
&lt;br /&gt;
A: &amp;lt;code&amp;gt;hex(-42 &amp;amp; 0xff) == '0xd6''&amp;lt;/code&amp;gt; I see thanks!&lt;/div&gt;</summary>
		<author><name>Gneale</name></author>
	</entry>
</feed>