<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"><<a href="mailto:nicolaihess@web.de" target="_blank">nicolaihess@web.de</a>></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__ >= 3<br># define BYTE_SWAP(w) __asm__("bswap %0" : "=r" (w) : "r" (w))<br># define WORD_SWAP(w) __asm__("roll $16, %0" : "=r" (w) : "r" (w))<br>
<br></div><div>This one would work<br># else<br># define BYTE_SWAP(w) __asm__("bswap %%eax" : "=eax" (w) : "eax" (w))<br># define WORD_SWAP(w) __asm__("roll $16, %%eax" : "=eax" (w) : "eax" (w))<br>
<br>This one, of course, works too<br># else<br># define BYTE_SWAP(w) w = (w << 24) | ((w & 0xFF00) << 8) | ((w >> 8) & 0xFF00) | (w >> 24)<br># define WORD_SWAP(w) w = (( (unsigned)(w) << 16) | ((unsigned) (w) >> 16))<br>
<br></div><div>This one is not there but would work (at least with gcc > 4.5<br># define BYTE_SWAP_MY(w) __asm__("bswap %0" : "+r" (w))<br># define WORD_SWAP_MY(w) __asm__("roll $16, %0" : "+r" (w))<br>
<br></div><div>But actually I don't know assembler and/or the gcc inline code syntax, so<br>I don'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't know :)<br><br></div><div><br></div>
</div></div></div></div></div></div></div>
<br></blockquote></div><br></div>