Debian Codegraph @

mypyc/lib-rt/base64/arch/generic/enc_head.c

raw
1 // Assume that *out is large enough to contain the output.
2 // Theoretically it should be 4/3 the length of src.
3 const uint8_t *s = (const uint8_t *) src;
4 uint8_t *o = (uint8_t *) out;
5
6 // Use local temporaries to avoid cache thrashing:
7 size_t olen = 0;
8 size_t slen = srclen;
9 struct base64_state st;
10 st.bytes = state->bytes;
11 st.carry = state->carry;
12
13 // Turn three bytes into four 6-bit numbers:
14 // in[0] = 00111111
15 // in[1] = 00112222
16 // in[2] = 00222233
17 // in[3] = 00333333
18
19 // Duff's device, a for() loop inside a switch() statement. Legal!
20 switch (st.bytes)
21 {
22 for (;;)
23 {
24 case 0: