]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/h8300/ctzhi2.c
clzhi2.c: Fix warnings.
[thirdparty/gcc.git] / gcc / config / h8300 / ctzhi2.c
CommitLineData
5d39821d
KH
1/* The implementation of __ctzhi2.
2 Copyright (C) 2003 Free Software Foundation, Inc.
3
7ec022b2 4This file is part of GCC.
5d39821d 5
7ec022b2 6GCC is free software; you can redistribute it and/or modify
5d39821d
KH
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11In addition to the permissions in the GNU General Public License, the
12Free Software Foundation gives you unlimited permission to link the
13compiled version of this file into combinations with other programs,
14and to distribute those combinations without any restriction coming
15from the use of this file. (The General Public License restrictions
16do apply in other respects; for example, they cover modification of
17the file, and distribution when not linked into a combine
18executable.)
19
7ec022b2 20GCC is distributed in the hope that it will be useful,
5d39821d
KH
21but WITHOUT ANY WARRANTY; without even the implied warranty of
22MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23GNU General Public License for more details.
24
25You should have received a copy of the GNU General Public License
7ec022b2 26along with GCC; see the file COPYING. If not, write to
5d39821d
KH
27the Free Software Foundation, 59 Temple Place - Suite 330,
28Boston, MA 02111-1307, USA. */
29
30int
31__ctzhi2 (unsigned short x)
32{
33 int i;
34 for (i = 0; i < 16; i++)
35 if (x & ((unsigned short) 1 << i))
36 break;
37 return i;
38}