String to bytes
giannissam
Posts: 22
Hello, i've been trying to convert a string to bytes in this way
say the string is "jj"
in binary its
01101010 01101010
i want to make
00000000 00000000
10000000 10000000
10000000 10000000
00000000 00000000
10000000 10000000
00000000 00000000
10000000 10000000
00000000 00000000
i made a code (attached) but somehow when it gets to the second j the bin is diferent. (By the way in my code i havent masked the bin numbers so i can see the process)
say the string is "jj"
in binary its
01101010 01101010
i want to make
00000000 00000000
10000000 10000000
10000000 10000000
00000000 00000000
10000000 10000000
00000000 00000000
10000000 10000000
00000000 00000000
i made a code (attached) but somehow when it gets to the second j the bin is diferent. (By the way in my code i havent masked the bin numbers so i can see the process)
Comments
from a quick look at your code I guess the memoryarea of
is too small as it contains only ONE byte
how about
to have a memory area of 32 bytes ?
Your encoding is compressed as much as possible
how about decompressing it for testpurposes
I mean one line of code for
checking if bit is 0 or 1
another line for setting msb
another line for increment the pointer
another line for shifting the bits ONE bit left etc.
and if this works properly starting to compress it
best regards
Stefan