<div dir="ltr">I can confirm this bug on windows Cog.<div><br></div><div>Cheers,</div><div>Karl</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 3, 2014 at 10:11 AM, Nicolai Hess <span dir="ltr">&lt;<a href="mailto:nicolaihess@web.de" target="_blank">nicolaihess@web.de</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br><div dir="ltr"><div><div><div><div><div>There is still something wrong with byte/word swap in windows ioShowDisplay code<br>
attached are two screenshots<br></div>squeak 4.5 image with cogvm from <a href="http://files.pharo.org/vm/cogmt/win/" target="_blank">http://files.pharo.org/vm/cogmt/win/</a><br>
</div>pharo 30793 image with latest vm from <a href="http://files.pharo.org/vm/pharo/win/" target="_blank">http://files.pharo.org/vm/pharo/win/</a><br></div><div>showing this bug after setting the Display depth to 16<br>
(Display newDepth:16)<br>
<br></div>sqwin32window.c has three variants for doing the byte_swap/word_swap on<br></div>bitdepths with big endian to convert to lsb<br><br></div>This one is active and causes this error.<br><div><div><div><div><div><div>

<div>#  if __GNUC__ &gt;= 3<br>#   define BYTE_SWAP(w) __asm__(&quot;bswap %0&quot; : &quot;=r&quot; (w) : &quot;r&quot; (w))<br>#   define WORD_SWAP(w) __asm__(&quot;roll $16, %0&quot; : &quot;=r&quot; (w) : &quot;r&quot; (w))<br>

<br></div><div>This one would work<br>#  else<br>#   define BYTE_SWAP(w) __asm__(&quot;bswap %%eax&quot; : &quot;=eax&quot; (w) : &quot;eax&quot; (w))<br>#   define WORD_SWAP(w) __asm__(&quot;roll $16, %%eax&quot; : &quot;=eax&quot; (w) : &quot;eax&quot; (w))<br>

<br>This one, of course, works too<br># else<br>#  define BYTE_SWAP(w) w = (w &lt;&lt; 24) | ((w &amp; 0xFF00) &lt;&lt; 8) | ((w &gt;&gt; 8) &amp; 0xFF00) | (w &gt;&gt; 24)<br>#  define WORD_SWAP(w) w = (( (unsigned)(w) &lt;&lt; 16) | ((unsigned) (w) &gt;&gt; 16))<br>

<br></div><div>This one is not there but would work (at least with gcc &gt; 4.5<br>#   define BYTE_SWAP_MY(w) __asm__(&quot;bswap %0&quot; : &quot;+r&quot; (w))<br>#   define WORD_SWAP_MY(w) __asm__(&quot;roll $16, %0&quot; : &quot;+r&quot; (w))<br>

<br></div><div>But actually I don&#39;t know assembler and/or the gcc inline code syntax, so<br>I don&#39;t know what is wrong with the first version :)<br><br></div><div>Nicolai<br><br></div><div>btw, you can not test this bug with the current squeak 4.5 all in on image,<br>

as it uses a rather old vm.<br><br>Third screenshot: <br>using the latest stable pharo-vm, it looks much more wrong, as there<br>was another(?) bug that is fixed already(?) - i don&#39;t know :)<br><br></div><div><br></div>

</div></div></div></div></div></div></div>
<br></blockquote></div><br></div>