Here's what I'm trying out:
Substitute characters into values with no set left bits;
check if the next position is a vowel(or whatever), turn it into a
value with no right bits set, join the two characters
into a single byte, delete the unused position now.
Here's the code using it, that I'm trying to get to work:
for(int i = 0; i < str.length(); i++)
{
/*swaps common letters with stuff in the 32-47 range*/
str[i] = Subcipher(str[i]);
if(str[i] < 127)
{
/*attempt to bring that common swapped stuff, below 16*/
str[i] -= 32;
/*check are bounadries!*/
if(str.length() - 1 != i)
{
/*if less/equal than 00001111*/
if(str[i] < 16)
{
/*is it in the alphabet range?*/
if(str[i + 1] > 96 && str[i + 1] < 118)
{
temp = str[i + 1];
if(temp == 'a') { temp = 128; join = true; }
/*...replacing vowels and stuff with no right set bits...*/
else if(temp == 'u') { temp = 240; join = true; }
if(join)
{
str[i] |= temp;
str.erase(i + 1, 1);
join = false;
} } } } } }
The problem is that when I attempt to "join" the values, it becomes negative/less than 128, even when I use something like str[i] +=temp;
, instead.
Can anyone point out if I'm just being stupid?
BTW, this is a compression algorithm that places vowels into a single byte, using the extended ASCII values to shove them on-top of. The reverse should be simpler, just having to shift stuff back-and-forth by four.