00001 /* Move half-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 __cmovh (short *dest, const short *src, unsigned len) 00031 { 00032 unsigned i; 00033 unsigned num = len >> 1; 00034 char *dest_byte = (char *)dest; 00035 const char *src_byte = (const char *)src; 00036 00037 if (dest_byte < src_byte || dest_byte > src_byte+len) 00038 { 00039 for (i = 0; i < num; i++) 00040 dest[i] = src[i]; 00041 00042 if ((len & 1) != 0) 00043 dest_byte[len-1] = src_byte[len-1]; 00044 } 00045 else 00046 { 00047 while (len-- > 0) 00048 dest_byte[len] = src_byte[len]; 00049 } 00050 }
1.5.6