[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] Yet another BitBlt source pastEnd access (#441)

Nicolas Cellier notifications at github.com
Wed Oct 30 21:53:55 UTC 2019


So, we need exactly 50 words to represent a row of source (width = 1600 pixels / 32 pixelPerWord).
Trying to read `nWords = 51` is asking for trouble...
We are translating 1 bit to the right, so the destination requires 51 words (1601 pixels).

What we ought to do in the `BitBlt>>copyLoop` is:
Copy 12bits from 1st src word (`mask1 - 16rFFF "4095"`) onto 1st dst word
Then 49 times copy the rotate thing (last bit from prev src word+31 bits from next src word) onto next dest word
```
    skewWord := ((prevWord bitAnd: notSkewMask) bitShift: unskew)
        bitOr:  "32-bit rotate"
    ((thisWord bitAnd: skewMask) bitShift: skew).
```
Then last bit of prev src word to next dest word (with `mask2 = 16r80000000`).

The incorrect code is in the last section, trying to read next sourceWord for nothing since it will be fully masked by `mask2` after rotation (skew).
So this last code requires a protection.
We could for example try `((skewMask bitShift: skew) bitAnd: mask2)`, and if null don't fetch next sourceWord (just use 0 instead).


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/441#issuecomment-548128984
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20191030/51af0669/attachment.html>


More information about the Vm-dev mailing list