if ( &lhs == &rhs ) return 0;  PRUint32 lLength = lhs.Length(); PRUint32 rLength = rhs.Length(); PRUint32 lengthToCompare = NS_MIN(lLength, rLength);  basic_nsAReadableString<CharT>::ReadingIterator leftIter( lhs.BeginReading() ); basic_nsAReadableString<CharT>::ReadingIterator rightIter( rhs.BeginReading() );  for (;;) { PRUint32 lengthAvailable = PRUint32( NS_MIN(leftIter.size_forward(), rightIter.size_forward()) );   if ( lengthAvailable > lengthToCompare ) lengthAvailable = lengthToCompare;  if ( int result = nsCharTraits<CharT>::compare(leftIter.operator->(), rightIter.operator->(), lengthAvailable) ) return result;  if ( !(lengthToCompare -= lengthAvailable) ) break;  leftIter += PRInt32(lengthAvailable); rightIter += PRInt32(lengthAvailable); }  if ( lLength < rLength ) return -1; else if ( rLength < lLength ) return 1; else return 0;
return ::Compare(*this, rhs);
Compare( const basic_nsAReadableString<CharT>& lhs, const basic_nsAReadableString<CharT>& rhs )  {    if ( &lhs == &rhs )      return 0;    PRUint32 lLength = lhs.Length();    PRUint32 rLength = rhs.Length();    PRUint32 lengthToCompare = NS_MIN(lLength, rLength);    basic_nsAReadableString<CharT>::ReadingIterator leftIter( lhs.BeginReading() );    basic_nsAReadableString<CharT>::ReadingIterator rightIter( rhs.BeginReading() );    for (;;)      {        PRUint32 lengthAvailable = PRUint32( NS_MIN(leftIter.size_forward(), rightIter.size_forward()) );        // assert( lengthAvailable >= 0 );        if ( lengthAvailable > lengthToCompare )          lengthAvailable = lengthToCompare;                if ( int result = nsCharTraits<CharT>::compare(leftIter.operator->(), rightIter.operator->(), lengthAvailable) )          return result;        if ( !(lengthToCompare -= lengthAvailable) )          break;        leftIter += PRInt32(lengthAvailable);        rightIter += PRInt32(lengthAvailable);      }    if ( lLength < rLength )      return -1;    else if ( rLength < lLength )      return 1;    else      return 0;  }