22void yaml::ScalarTraits<yaml::BinaryRef>::output(
29 if (
Scalar.size() % 2 != 0)
30 return "BinaryRef hex string must contain an even number of nybbles.";
34 return "BinaryRef hex string must contain only hex digits.";
40 if (!DataIsHexString) {
45 for (
uint64_t I = 0, E = std::min<uint64_t>(
N, Data.
size() / 2);
I != E;
47 uint8_t Byte = llvm::hexDigitValue(Data[
I * 2]);
49 Byte |= llvm::hexDigitValue(Data[
I * 2 + 1]);
55 if (binary_size() == 0)
57 if (DataIsHexString) {
61 for (uint8_t Byte :
Data)
62 OS << hexdigit(Byte >> 4) << hexdigit(Byte & 0xf);
size_t size() const
size - Get the array size.
StringRef - Represent a constant reference to a string, i.e.
This class implements an extremely fast bulk output stream that can only output to a stream.
raw_ostream & write(unsigned char C)
Specialized YAMLIO scalar type for representing a binary blob.
void writeAsHex(raw_ostream &OS) const
Write the contents (regardless of whether it is binary or a hex string) as hex to the given raw_ostre...
void writeAsBinary(raw_ostream &OS, uint64_t N=UINT64_MAX) const
Write the contents (regardless of whether it is binary or a hex string) as binary to the given raw_os...
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.