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