// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file.
#include"base/strings/string16.h"
#ifdefined(WCHAR_T_IS_UTF16) && !defined(_AIX)
#errorThis file should not be used on 2-byte wchar_t systems // If this winds up being needed on 2-byte wchar_t systems, either the // definitions below can be used, or the host system's wide character // functions like wmemcmp can be wrapped.
#elifdefined(WCHAR_T_IS_UTF32)
#include <ostream>
#include"base/strings/string_piece.h"
namespace base {
int c16memcmp(const char16* s1, const char16* s2, size_t n) { // We cannot call memcmp because that changes the semantics. while (n-- > 0) { if (*s1 != *s2) { // We cannot use (*s1 - *s2) because char16 is unsigned. return ((*s1 < *s2) ? -1 : 1);
}
++s1;
++s2;
} return 0;
}
size_t c16len(const char16* s) { const char16 *s_orig = s; while (*s) {
++s;
} return s - s_orig;
}
const char16* c16memchr(const char16* s, char16 c, size_t n) { while (n-- > 0) { if (*s == c) { return s;
}
++s;
} return nullptr;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.