/* Encodes the input as a byte string in a way that can be unambiguously parsed from the beginning of the string by inserting the length of the byte string before the byte string representation of input. */
UINTN EFIAPI LeftEncode(OUT UINT8 *EncBuf, IN UINTN Value)
/* Encodes the input as a byte string in a way that can be unambiguously parsed from the beginning of the string by inserting the length of the byte string before the byte string representation of input. */
UINTN EFIAPI LeftEncode(OUT UINT8 *EncBuf, IN UINTN Value)
{
  UINT32  BlockNum;
  UINT32  EncLen;
  UINT32  Index;
  UINTN   ValueCopy;
  for ( ValueCopy = Value, BlockNum = 0; ValueCopy && (BlockNum < sizeof (UINTN)); ++BlockNum, ValueCopy >>= 8 ) {
  }
  if (BlockNum == 0) {
    BlockNum = 1;
  }
  for (Index = 1; Index <= BlockNum; ++Index) {
    EncBuf[Index] = (UINT8)(Value >> (8 * (BlockNum - Index)));
  }
  EncBuf[0] = (UINT8)BlockNum;
  EncLen    = BlockNum + 1;
  return EncLen;
}