/* If String is not aligned on a 16-bit boundary, then ASSERT(). */
UINTN EFIAPI StrnLenS(IN CONST CHAR16 *String, IN UINTN MaxSize)
/* If String is not aligned on a 16-bit boundary, then ASSERT(). */
UINTN EFIAPI StrnLenS(IN CONST CHAR16 *String, IN UINTN MaxSize)
{
  UINTN  Length;
  ASSERT (((UINTN)String & BIT0) == 0);
  if ((String == NULL) || (MaxSize == 0)) {
    return 0;
  }
  Length = 0;
  while (String[Length] != 0) {
    if (Length >= MaxSize - 1) {
      return MaxSize;
    }
    Length++;
  }
  return Length;
}