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

karl ramberg karlramberg at gmail.com
Thu Apr 3 15:51:12 UTC 2014


I can confirm this bug on windows Cog.

Cheers,
Karl


On Thu, Apr 3, 2014 at 10:11 AM, Nicolai Hess <nicolaihess at web.de> wrote:

>
> 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.squeakfoundation.org/pipermail/vm-dev/attachments/20140403/aeeef8df/attachment.htm


More information about the Vm-dev mailing list