while (src_i < src_len)
{ if ((src_len - src_i) >= 4)
{ /* Usual case - full quantum */
CM_LOOKUP(src[src_i++], a);
CM_LOOKUP(src[src_i++], b);
CM_LOOKUP(src[src_i++], c);
CM_LOOKUP(src[src_i++], d);
} else
{ /* Add padding on the end to make up the full quantum */
CM_LOOKUP(src[src_i++], a);
b = E_PAD;
c = E_PAD;
d = E_PAD; if ((src_len - src_i) > 0)
{
CM_LOOKUP(src[src_i++], b);
} if ((src_len - src_i) > 0)
{
CM_LOOKUP(src[src_i++], c);
}
}
/* *Bitwise-orthetranslatedquantumvaluestogether,sothat *anyinvalidorpaddingcharacterscanbedetectedwitha
* single test */
v = a | b | c | d;
if ((v & E_INVALID) != 0)
{ return -1; /* At least one invalid character */
}
if ((v & E_PAD) == 0)
{ /* No padding - a full quantum */
v = (a << 18) | (b << 12) | (c << 6) | d;
OUTPUT_CHAR(v >> 16);
OUTPUT_CHAR((v >> 8) & 0xff);
OUTPUT_CHAR(v & 0xff);
} elseif (((a | b | c) & E_PAD) == 0)
{ /* No padding in the first 3 chars, so the padding must
* be at the end */
v = (a << 10) | (b << 4) | (c >> 2);
OUTPUT_CHAR(v >> 8);
OUTPUT_CHAR(v & 0xff);
} elseif (((a | b) & E_PAD) == 0 && c == d)
{ /* No padding in first two chars, so if the last two chars are
* equal, they must both be padding */
v = (a << 2) | (b >> 4);
OUTPUT_CHAR(v);
} else
{ /* Illegal padding */ return -1;
}
}
/* Each three octets of the source results in four bytes at the output, *plusweneedaterminator.Sowecanworkoutthemaximumnumberof
* source octets we can process */ if (dst_len == 0)
{
max_src_len = 0;
} else
{
max_src_len = (dst_len - 1) / 4 * 3;
}
if (src_len > max_src_len)
{
src_len = max_src_len;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.