Hi Don,
Thanks for that. I've tried to figure your code out without much luck, that visual representation helps me understand how you intend it to work. First I got thrown off by the arrays not being indexed from 0 and I thoght that was by intention (some trick) to make it work but now I'm not sure and I have to ask if you tried it?
If I load arr1 with 77,97,110 I expect to get 19,22,5,46 (taken from Wikipedias example) but instead I get 19,0,4,0.
The reason, I think, is that you're trying to load two bytes from the array into one word in one go with w1=arr1[1] etc.
/Henrik.
EDIT: It's not near as small as yours but this works for me:
Code:
Out[0] = ((In[0] >> 2) & 63)
Out[1] = ((In[0] & 3) << 4) + ((In[1] & 240) >> 4) & 63
Out[2] = ((In[1] & 15) << 2) + ((In[2] & 192) >> 6) & 63
Out[3] = (In[2] & 63)
Bookmarks