aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/base64/avx2/enc_tail.c
blob: e4362db594ab5104dd5417717ee7385ec4aceb63 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
		if (srclen-- == 0) {
			break;
		}
		*o++ = avx2_base64_table_enc[*c >> 2];
		st.carry = (*c++ << 4) & 0x30;
		st.bytes++;
		outl += 1;

	case 1:	if (srclen-- == 0) {
			break;
		}
		*o++ = avx2_base64_table_enc[st.carry | (*c >> 4)];
		st.carry = (*c++ << 2) & 0x3C;
		st.bytes++;
		outl += 1;

	case 2:	if (srclen-- == 0) {
			break;
		}
		*o++ = avx2_base64_table_enc[st.carry | (*c >> 6)];
		*o++ = avx2_base64_table_enc[*c++ & 0x3F];
		st.bytes = 0;
		outl += 2;
	}
}
state->bytes = st.bytes;
state->carry = st.carry;
*outlen = outl;