binary consts removed (gcc)

master
Tomek Dubrownik 2012-05-01 03:31:29 +02:00
parent 343fc2dc58
commit d5ad446682
1 changed files with 9 additions and 9 deletions

View File

@ -113,10 +113,10 @@ void bin_to_b64(char *out, char* in, unsigned int in_length)
char a, b, c;
a = in[i * 3]; b = in[i * 3 + 1]; c = in[i * 3 + 2];
out[i * 4 ] = b64_lut[ (a & 0b11111100) >> 2 ];
out[i * 4 + 1] = b64_lut[((a & 0b00000011) << 4 ) | ((b & 0b11110000) >> 4)];
out[i * 4 + 2] = b64_lut[((b & 0b00001111) << 2) | ((c & 0b11000000) >> 6)];
out[i * 4 + 3] = b64_lut[ c & 0b00111111 ];
out[i * 4 ] = b64_lut[ (a & 252) >> 2 ];
out[i * 4 + 1] = b64_lut[((a & 3) << 4 ) | ((b & 240) >> 4)];
out[i * 4 + 2] = b64_lut[((b & 15) << 2) | ((c & 192) >> 6)];
out[i * 4 + 3] = b64_lut[ c & 63 ];
}
unsigned int final_length = complete_quads * 4;
@ -126,8 +126,8 @@ void bin_to_b64(char *out, char* in, unsigned int in_length)
case 1:
{
char a = in[complete_quads * 3];
out[complete_quads * 4 ] = b64_lut[(a & 0b11111100) >> 2];
out[complete_quads * 4 + 1] = b64_lut[(a & 0b00000011) << 4];
out[complete_quads * 4 ] = b64_lut[(a & 252) >> 2];
out[complete_quads * 4 + 1] = b64_lut[(a & 3) << 4];
out[complete_quads * 4 + 2] = '=';
out[complete_quads * 4 + 3] = '=';
final_length += 4;
@ -137,9 +137,9 @@ void bin_to_b64(char *out, char* in, unsigned int in_length)
{
char a, b;
a = in[complete_quads * 3]; b = in[complete_quads * 3 + 1];
out[complete_quads * 4 ] = b64_lut[ (a & 0b11111100) >> 2 ];
out[complete_quads * 4 + 1] = b64_lut[((a & 0b00000011) << 4) | ((b & 0b11110000) >> 4)];
out[complete_quads * 4 + 2] = b64_lut[((b & 0b00001111) << 2) ];
out[complete_quads * 4 ] = b64_lut[ (a & 252) >> 2 ];
out[complete_quads * 4 + 1] = b64_lut[((a & 3) << 4) | ((b & 240) >> 4)];
out[complete_quads * 4 + 2] = b64_lut[((b & 15) << 2) ];
out[complete_quads * 4 + 3] = '=';
final_length += 4;
break;