memcmp.c revision 163533
1169691Skan/*- 2169691Skan * Copyright (c) 2006 M. Warner Losh. All rights reserved. 3169691Skan * 4169691Skan * Redistribution and use in source and binary forms, with or without 5169691Skan * modification, are permitted provided that the following conditions 6169691Skan * are met: 7169691Skan * 1. Redistributions of source code must retain the above copyright 8169691Skan * notice, this list of conditions and the following disclaimer. 9169691Skan * 2. Redistributions in binary form must reproduce the above copyright 10169691Skan * notice, this list of conditions and the following disclaimer in the 11169691Skan * documentation and/or other materials provided with the distribution. 12169691Skan * 13169691Skan * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14169691Skan * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15169691Skan * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16169691Skan * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17169691Skan * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18169691Skan * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19169691Skan * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20169691Skan * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21169691Skan * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22169691Skan * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23169691Skan * 24169691Skan * This software is derived from software provide by Kwikbyte who specifically 25169691Skan * disclaimed copyright on the code. 26169691Skan * 27169691Skan * $FreeBSD: head/sys/boot/arm/at91/libat91/memcmp.c 163533 2006-10-20 09:12:05Z imp $ 28169691Skan */ 29169691Skan#include "lib.h" 30169691Skan 31169691Skanint 32169691Skanp_memcmp(const char *to, const char *from, unsigned size) 33169691Skan{ 34169691Skan while ((--size) && (*to++ == *from++)) 35169691Skan continue; 36169691Skan 37169691Skan return (*to != *from); 38169691Skan} 39169691Skan