MCPcopy Create free account
hub / github.com/TASEmulators/fceux / Base64Table

Class Base64Table

src/utils/xstring.cpp:183–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181}
182
183static const struct Base64Table
184{
185 Base64Table()
186 {
187 size_t a=0;
188 for(a=0; a<256; ++a) data[a] = 0xFF; // mark everything as invalid by default
189 // create value->ascii mapping
190 a=0;
191 for(unsigned char c='A'; c<='Z'; ++c) data[a++] = c; // 0..25
192 for(unsigned char c='a'; c<='z'; ++c) data[a++] = c; // 26..51
193 for(unsigned char c='0'; c<='9'; ++c) data[a++] = c; // 52..61
194 data[62] = '+'; // 62
195 data[63] = '/'; // 63
196 // create ascii->value mapping (but due to overlap, write it to highbit region)
197 for(a=0; a<64; ++a) data[data[a]^0x80] = static_cast<unsigned char>(a); //
198 data[((unsigned char)'=') ^ 0x80] = 0;
199 }
200 unsigned char operator[] (size_t pos) const { return data[pos]; }
201private:
202 unsigned char data[256];
203} Base64Table;
204
205///Converts the provided data to a string in a standard, user-friendly, round-trippable format
206std::string BytesToString(const void* data, int len)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected