]>
Commit | Line | Data |
---|---|---|
c63539ff ML |
1 | .. |
2 | Copyright 1988-2022 Free Software Foundation, Inc. | |
3 | This is part of the GCC manual. | |
4 | For copying conditions, see the copyright.rst file. | |
5 | ||
6 | .. _trailz: | |
7 | ||
8 | TRAILZ --- Number of trailing zero bits of an integer | |
9 | ***************************************************** | |
10 | ||
11 | .. index:: TRAILZ, zero bits | |
12 | ||
13 | .. function:: TRAILZ(I) | |
14 | ||
15 | ``TRAILZ`` returns the number of trailing zero bits of an integer. | |
16 | ||
17 | :param I: | |
18 | Shall be of type ``INTEGER``. | |
19 | ||
20 | :return: | |
21 | The type of the return value is the default ``INTEGER``. | |
22 | If all the bits of ``I`` are zero, the result value is ``BIT_SIZE(I)``. | |
23 | ||
24 | Standard: | |
25 | Fortran 2008 and later | |
26 | ||
27 | Class: | |
28 | Elemental function | |
29 | ||
30 | Syntax: | |
31 | .. code-block:: fortran | |
32 | ||
33 | RESULT = TRAILZ(I) | |
34 | ||
35 | Example: | |
36 | .. code-block:: fortran | |
37 | ||
38 | PROGRAM test_trailz | |
39 | WRITE (*,*) TRAILZ(8) ! prints 3 | |
40 | END PROGRAM | |
41 | ||
42 | See also: | |
43 | :ref:`BIT_SIZE`, | |
44 | :ref:`LEADZ`, | |
45 | :ref:`POPPAR`, | |
3ed1b4ce | 46 | :ref:`POPCNT` |