<p></p>
<p dir="auto">If we wanted to handle 16bits depth without split (thus 6 channels in parallel on a 32bits word), that would get a bit tricky due to the dead-bit.<br>
We would need two different masks, because shifting a mask does not produce the other one:</p>
<pre class="notranslate"><code class="notranslate">lowMask :=  2r00000011111000000111110000011111. "green2-red1-blue1"
highMask := 2r01111100000111110000001111100000. "red2-blue2-green1"
highWordShift := 27.
doubleGroupMask := 2r0000001111100000011111000001111100000011111000000111110000011111. "highMask << highWordShift + lowMask"
doubleWord1 := word1 bitAnd: highMask.
doubleWord2 := word2 bitAnd: highMask.
doubleWord1 := doubleWord1 << highWordShift + (word1 bitAnd: lowMask).
doubleWord2 := doubleWord2 << highWordShift + (word2 bitAnd: lowMask).
</code></pre>
<p dir="auto">Then the shifts for accessing each component in double word would be tricky, either 10 or 11 in the loop (0 10 21 32 42 53).</p>
<pre class="notranslate"><code class="notranslate">extraShift := 2r10110.
shift := 0.
0 to: 5 do: [:i |
    doubleWordMul := doubleWordMul + (((doubleWordSrc >> shift bitAnd: channelMask) * (doubleWordSrc >> shift bitAnd: channelMask) + half) << shift).
    shift := shift + (2 * nBits) + (extraShift >> i bitAnd: 1)].
</code></pre>
<p dir="auto">The rest should work unchanged.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/651#issuecomment-1227847296">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AIJPEW2P6HRPZQNRFBIBKGLV275UBANCNFSM57SPOYNQ">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AIJPEW75AJNXTCFWHL6KRALV275UBA5CNFSM57SPOYN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOJEXXNAA.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><OpenSmalltalk/opensmalltalk-vm/issues/651/1227847296</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/651#issuecomment-1227847296",
"url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/651#issuecomment-1227847296",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>