[Pharo-dev] bug on windows ioShowDisplay for bitdepth 16/8/4 (big endian)

Nicolai Hess nicolaihess at web.de
Thu Apr 3 04:11:31 EDT 2014


There is still something wrong with byte/word swap in windows ioShowDisplay
code
attached are two screenshots
squeak 4.5 image with cogvm from http://files.pharo.org/vm/cogmt/win/
pharo 30793 image with latest vm from http://files.pharo.org/vm/pharo/win/
showing this bug after setting the Display depth to 16
(Display newDepth:16)

sqwin32window.c has three variants for doing the byte_swap/word_swap on
bitdepths with big endian to convert to lsb

This one is active and causes this error.
#  if __GNUC__ >= 3
#   define BYTE_SWAP(w) __asm__("bswap %0" : "=r" (w) : "r" (w))
#   define WORD_SWAP(w) __asm__("roll $16, %0" : "=r" (w) : "r" (w))

This one would work
#  else
#   define BYTE_SWAP(w) __asm__("bswap %%eax" : "=eax" (w) : "eax" (w))
#   define WORD_SWAP(w) __asm__("roll $16, %%eax" : "=eax" (w) : "eax" (w))

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

This one is not there but would work (at least with gcc > 4.5
#   define BYTE_SWAP_MY(w) __asm__("bswap %0" : "+r" (w))
#   define WORD_SWAP_MY(w) __asm__("roll $16, %0" : "+r" (w))

But actually I don't know assembler and/or the gcc inline code syntax, so
I don't know what is wrong with the first version :)

Nicolai

btw, you can not test this bug with the current squeak 4.5 all in on image,
as it uses a rather old vm.

Third screenshot:
using the latest stable pharo-vm, it looks much more wrong, as there
was another(?) bug that is fixed already(?) - i don't know :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20140403/65ed9eda/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: squeak_cog_latest_render_bug.png
Type: image/png
Size: 178294 bytes
Desc: not available
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20140403/65ed9eda/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pharo_latest_render_bug.png
Type: image/png
Size: 165383 bytes
Desc: not available
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20140403/65ed9eda/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pharo_stable_render_bug.png
Type: image/png
Size: 164973 bytes
Desc: not available
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20140403/65ed9eda/attachment-0002.png>


More information about the Pharo-dev mailing list