1 // Copyright 2016 The Fuchsia Authors 2 // Copyright (c) 2008 Travis Geiselbrecht 3 // 4 // Use of this source code is governed by a MIT-style 5 // license that can be found in the LICENSE file or at 6 // https://opensource.org/licenses/MIT 7 8 #include <string.h> 9 #include <sys/types.h> 10 11 int memcmp(const void * cs,const void * ct,size_t count)12memcmp(const void *cs, const void *ct, size_t count) 13 { 14 const unsigned char *su1, *su2; 15 signed char res = 0; 16 17 for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--) 18 if ((res = *su1 - *su2) != 0) 19 break; 20 return res; 21 } 22