/* If String is NULL, then ASSERT(). If String is not aligned on a 16-bit boundary, then ASSERT(). */
UINTN BmStrSizeEx(IN CONST CHAR16 *String, IN UINTN MaxStringLen)
/* If String is NULL, then ASSERT(). If String is not aligned on a 16-bit boundary, then ASSERT(). */
UINTN BmStrSizeEx(IN CONST CHAR16 *String, IN UINTN MaxStringLen)
{
  UINTN  Length;
  ASSERT (String != NULL && MaxStringLen != 0);
  ASSERT (((UINTN)String & BIT0) == 0);
  for (Length = 0; *String != L'\0' && MaxStringLen != Length; String++, Length += 2) {
  }
  if ((*String != L'\0') && (MaxStringLen == Length)) {
    return 0;
  }
  return Length + 2;
}