00001 /* Move word library function. 00002 Copyright (C) 2000, 2003 Free Software Foundation, Inc. 00003 Contributed by Red Hat, Inc. 00004 00005 This file is part of GCC. 00006 00007 GCC is free software ; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation * either version 2, or (at your option) 00010 any later version. 00011 00012 GCC is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY ; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with GCC; see the file COPYING. If not, write to 00019 the Free Software Foundation, 59 Temple Place - Suite 330, 00020 Boston, MA 02111-1307, USA. */ 00021 00022 /* As a special exception, if you link this library with other files, 00023 some of which are compiled with GCC, to produce an executable, 00024 this library does not by itself cause the resulting executable 00025 to be covered by the GNU General Public License. 00026 This exception does not however invalidate any other reasons why 00027 the executable file might be covered by the GNU General Public License. */ 00028 00029 void 00030 __cmovw (int *dest, const int *src, unsigned len) 00031 { 00032 unsigned i; 00033 unsigned num = len >> 2; 00034 unsigned xlen = len & ~3; 00035 char *dest_byte = (char *)dest; 00036 const char *src_byte = (const char *)src; 00037 00038 if (dest_byte < src_byte || dest_byte > src_byte+len) 00039 { 00040 for (i = 0; i < num; i++) 00041 dest[i] = src[i]; 00042 00043 while (len > xlen) 00044 { 00045 dest_byte[xlen] = src_byte[xlen]; 00046 xlen++; 00047 } 00048 } 00049 else 00050 { 00051 while (len-- > 0) 00052 dest_byte[len] = src_byte[len]; 00053 } 00054 }
1.5.6