Low-level integer routines with gcc

From LPTMS Wiki
Revision as of 17:30, 11 April 2012 by Roux (talk | contribs)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Gcc supports low-level integer routines similar to the FORTRAN routines POPCOUNT, ISHIFT... <source lang="cpp"> long long __ashlti3 (long long a, int b ) //These functions return the result of shifting a left by b bits. long long __ashrti3 (long long a, int b ) //These functions return the result of arithmetically shifting a right by b bits. long long __divti3 (long long a, long long b ) //These functions return the quotient of the signed division of a and b. long long __lshrti3 (long long a, int b ) //These functions return the result of logically shifting a right by b bits. int __clzti2 (long long a ) //These functions return the number of leading 0-bits in a, starting at the most significant bit position.

                           //If a is zero, the result is undefined.

int __ctzti2 (long long a ) //These functions return the number of trailing 0-bits in a, starting at the least significant bit position.

                           //If a is zero, the result is undefined.

int __ffsti2 (long long a ) //These functions return the index of the least significant 1-bit in a, or the value zero if a is zero.

                           // The least significant bit is index one.

int __parityti2 (long long a ) //These functions return the value zero if the number of bits set in a is even, and the value one otherwise. int __popcountti2 (long long a ) //These functions return the number of bits set in a. int64_t __bswapdi2 (int64 t a ) //These functions return the a byteswapped. </source>