00001 /* The implementation of __parityhi2. 00002 Copyright (C) 2003 Free Software Foundation, Inc. 00003 00004 This file is part of GCC. 00005 00006 GCC is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2, or (at your option) 00009 any later version. 00010 00011 In addition to the permissions in the GNU General Public License, the 00012 Free Software Foundation gives you unlimited permission to link the 00013 compiled version of this file into combinations with other programs, 00014 and to distribute those combinations without any restriction coming 00015 from the use of this file. (The General Public License restrictions 00016 do apply in other respects; for example, they cover modification of 00017 the file, and distribution when not linked into a combine 00018 executable.) 00019 00020 GCC is distributed in the hope that it will be useful, 00021 but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 GNU General Public License for more details. 00024 00025 You should have received a copy of the GNU General Public License 00026 along with GCC; see the file COPYING. If not, write to 00027 the Free Software Foundation, 59 Temple Place - Suite 330, 00028 Boston, MA 02111-1307, USA. */ 00029 00030 int __parityhi2 (unsigned short x); 00031 00032 int 00033 __parityhi2 (unsigned short x) 00034 { 00035 int i; 00036 int count = 0; 00037 for (i = 0; i < 16; i++) 00038 if (x & ((unsigned short) 1 << i)) 00039 count++; 00040 return count & 1; 00041 }
1.5.6