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 22 int32_t memcmp16_generic_static(const uint16_t* s0, const uint16_t* s1, size_t count); 23 int32_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 32 namespace art { 33 34 namespace testing { 35 36 int32_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 44 #pragma GCC diagnostic warning "-Wunused-function" 45