26 ms·
This doesn't work efficiently for non-square arrays. E.g. if you have a 128x32 then you don't want to interleave the y bits once they are exhausted (only need
by tubs 2y ago
This doesn't work efficiently for non-square arrays.
E.g. if you have a 128x32 then you don't want to interleave the y bits once they are exhausted (only need 5 bits of y, but 7 bits of x to fully address this).
The posted implementation would produce
y6,x6,y5,x5,y4,x4,y3,x3,y2,x2,y1,x1,y0,x0
but really we want:
x6,x5,y4,x4,y3,x3,y2,x2,y1,x1,y0,x0
- HelloNurse 2y agoIn a microprocessor with fixed-size registers numbers of 5 and 7 bits are going to be extended to at least 8 bits and interleaved into a code of 16, 32, 64 or even more bits: knowing that y5 and y6 are zero doesn't allow for a more efficient computation. On the other hand, if you intend to store and compare compact codes of 12 bits you only need a few shift, OR and AND operations (or possibly dedicated fancy instructions) to knock out the known zero bits and place the significant digits contiguously.