MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / DecodeThreeChars

Function DecodeThreeChars

tensorflow/core/lib/strings/base64.cc:61–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61Status DecodeThreeChars(const char* codes, char* result) {
62 const uint32 packed = (Convert(codes[0]) << 18) | (Convert(codes[1]) << 12) |
63 (Convert(codes[2]) << 6) | (Convert(codes[3]));
64 // Convert() return value has upper 25 bits set if input is invalid.
65 // Therefore `packed` has high bits set iff at least one of code is invalid.
66 if (TF_PREDICT_FALSE((packed & 0xFF000000) != 0)) {
67 return errors::InvalidArgument("Invalid character found in base64.");
68 }
69 result[0] = static_cast<char>(packed >> 16);
70 result[1] = static_cast<char>(packed >> 8);
71 result[2] = static_cast<char>(packed);
72 return Status::OK();
73}
74} // namespace
75
76Status Base64Decode(StringPiece data, string* decoded) {

Callers 1

Base64DecodeFunction · 0.85

Calls 2

InvalidArgumentFunction · 0.85
ConvertFunction · 0.70

Tested by

no test coverage detected