blob: 813df2f1d7ca9bea50ec7e4f98dae8b28e055594 [file] [log] [blame]
Andreas Gampe4d0589c2014-06-10 16:10:56 -07001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "memcmp16.h"
18
19// This linked against by assembly stubs, only.
20#pragma GCC diagnostic ignored "-Wunused-function"
21
Andreas Gampe277ccbd2014-11-03 21:36:10 -080022int32_t memcmp16_generic_static(const uint16_t* s0, const uint16_t* s1, size_t count);
Andreas Gampe4d0589c2014-06-10 16:10:56 -070023int32_t memcmp16_generic_static(const uint16_t* s0, const uint16_t* s1, size_t count) {
24 for (size_t i = 0; i < count; i++) {
25 if (s0[i] != s1[i]) {
26 return static_cast<int32_t>(s0[i]) - static_cast<int32_t>(s1[i]);
27 }
28 }
29 return 0;
30}
31
Andreas Gampe29b38412014-08-13 00:15:43 -070032namespace art {
33
34namespace testing {
35
36int32_t MemCmp16Testing(const uint16_t* s0, const uint16_t* s1, size_t count) {
37 return MemCmp16(s0, s1, count);
38}
39
40}
41
42} // namespace art
43
Andreas Gampe4d0589c2014-06-10 16:10:56 -070044#pragma GCC diagnostic warning "-Wunused-function"