llvm::tryGetHexFromNibbles

Decode two hex digit characters into a byte.

Synopsis

Declared in <llvm/ADT/StringExtras.h>

bool
tryGetHexFromNibbles(
    char MSB,
    char LSB,
    uint8_t& Hex);

Description

Store the binary representation of the two provided values, MSB and LSB, that make up the nibbles of a hexadecimal digit. If MSB or LSB do not correspond to proper nibbles of a hexadecimal digit, this method returns false. Otherwise, returns true.

Return Value

True if both characters were valid hex digits.

Parameters

NameDescription
MSBhigh nibble as a hex digit character
LSBlow nibble as a hex digit character
Hexset to the decoded byte on success