MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / encodeblock

Function encodeblock

imperative/src/impl/utils/base64.cpp:25–31  ·  view source on GitHub ↗

** encodeblock ** ** encode 3 8-bit binary bytes as 4 '6-bit' characters */

Source from the content-addressed store, hash-verified

23** encode 3 8-bit binary bytes as 4 '6-bit' characters
24*/
25void encodeblock(unsigned char in[3], unsigned char out[4], int len) {
26 out[0] = cb64[in[0] >> 2];
27 out[1] = cb64[((in[0] & 0x03) << 4) | ((in[1] & 0xf0) >> 4)];
28 out[2] =
29 (unsigned char)(len > 1 ? cb64[((in[1] & 0x0f) << 2) | ((in[2] & 0xc0) >> 6)] : '=');
30 out[3] = (unsigned char)(len > 2 ? cb64[in[2] & 0x3f] : '=');
31}
32
33/*
34** decodeblock

Callers 1

encodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected