1 /*
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 
memcmp16_generic_static(const uint16_t * s0,const uint16_t * s1,size_t count)22 int32_t memcmp16_generic_static(const uint16_t* s0, const uint16_t* s1, size_t count) {
23   for (size_t i = 0; i < count; i++) {
24     if (s0[i] != s1[i]) {
25       return static_cast<int32_t>(s0[i]) - static_cast<int32_t>(s1[i]);
26     }
27   }
28   return 0;
29 }
30 
31 namespace art {
32 
33 namespace testing {
34 
MemCmp16Testing(const uint16_t * s0,const uint16_t * s1,size_t count)35 int32_t MemCmp16Testing(const uint16_t* s0, const uint16_t* s1, size_t count) {
36   return MemCmp16(s0, s1, count);
37 }
38 
39 }
40 
41 }  // namespace art
42 
43 #pragma GCC diagnostic warning "-Wunused-function"
44