<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-us" xml:lang="en-us"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta> <meta http-equiv="X-UA-Compatible" content="IE=edge"></meta> <meta name="copyright" content="(C) Copyright 2005"></meta> <meta name="DC.rights.owner" content="(C) Copyright 2005"></meta> <meta name="DC.Type" content="cppModule"></meta> <meta name="DC.Title" content="Integer Intrinsics"></meta> <meta name="abstract" content=""></meta> <meta name="description" content=""></meta> <meta name="DC.Format" content="XHTML"></meta> <meta name="DC.Identifier" content="group__CUDA__MATH__INTRINSIC__INT"></meta> <link rel="stylesheet" type="text/css" href="../common/formatting/commonltr.css"></link> <link rel="stylesheet" type="text/css" href="../common/formatting/site.css"></link> <title>CUDA Math API :: CUDA Toolkit Documentation</title> <!--[if lt IE 9]> <script src="../common/formatting/html5shiv-printshiv.min.js"></script> <![endif]--> <script type="text/javascript" charset="utf-8" src="../common/scripts/tynt/tynt.js"></script> <script type="text/javascript" charset="utf-8" src="../common/formatting/jquery.min.js"></script> <script type="text/javascript" charset="utf-8" src="../common/formatting/jquery.ba-hashchange.min.js"></script> <script type="text/javascript" charset="utf-8" src="../common/formatting/jquery.scrollintoview.min.js"></script> <script type="text/javascript" src="../search/htmlFileList.js"></script> <script type="text/javascript" src="../search/htmlFileInfoList.js"></script> <script type="text/javascript" src="../search/nwSearchFnt.min.js"></script> <script type="text/javascript" src="../search/stemmers/en_stemmer.min.js"></script> <script type="text/javascript" src="../search/index-1.js"></script> <script type="text/javascript" src="../search/index-2.js"></script> <script type="text/javascript" src="../search/index-3.js"></script> <link rel="canonical" href="http://docs.nvidia.com/cuda/cuda-math-api/index.html"></link> <link rel="stylesheet" type="text/css" href="../common/formatting/qwcode.highlight.css"></link> </head> <body> <header id="header"><span id="company">NVIDIA</span><span id="site-title">CUDA Toolkit Documentation</span><form id="search" method="get" action="search"> <input type="text" name="search-text"></input><fieldset id="search-location"> <legend>Search In:</legend> <label><input type="radio" name="search-type" value="site"></input>Entire Site</label> <label><input type="radio" name="search-type" value="document"></input>Just This Document</label></fieldset> <button type="reset">clear search</button> <button id="submit" type="submit">search</button></form> </header> <div id="site-content"> <nav id="site-nav"> <div class="category closed"><a href="../index.html" title="The root of the site.">CUDA Toolkit v6.5</a></div> <div class="category"><a href="index.html" title="CUDA Math API">CUDA Math API</a></div> <ul> <li> <div class="section-link"><a href="modules.html#modules">1. Modules</a></div> <ul> <li> <div class="section-link"><a href="group__CUDA__MATH.html#group__CUDA__MATH">1.1. Mathematical Functions</a></div> </li> <li> <div class="section-link"><a href="group__CUDA__MATH__SINGLE.html#group__CUDA__MATH__SINGLE">1.2. Single Precision Mathematical Functions</a></div> </li> <li> <div class="section-link"><a href="group__CUDA__MATH__DOUBLE.html#group__CUDA__MATH__DOUBLE">1.3. Double Precision Mathematical Functions</a></div> </li> <li> <div class="section-link"><a href="group__CUDA__MATH__INTRINSIC__SINGLE.html#group__CUDA__MATH__INTRINSIC__SINGLE">1.4. Single Precision Intrinsics</a></div> </li> <li> <div class="section-link"><a href="group__CUDA__MATH__INTRINSIC__DOUBLE.html#group__CUDA__MATH__INTRINSIC__DOUBLE">1.5. Double Precision Intrinsics</a></div> </li> <li> <div class="section-link"><a href="group__CUDA__MATH__INTRINSIC__INT.html#group__CUDA__MATH__INTRINSIC__INT">1.6. Integer Intrinsics</a></div> </li> <li> <div class="section-link"><a href="group__CUDA__MATH__INTRINSIC__CAST.html#group__CUDA__MATH__INTRINSIC__CAST">1.7. Type Casting Intrinsics</a></div> </li> <li> <div class="section-link"><a href="group__CUDA__MATH__INTRINSIC__SIMD.html#group__CUDA__MATH__INTRINSIC__SIMD">1.8. SIMD Intrinsics</a></div> </li> </ul> </li> <li> <div class="section-link"><a href="notices-header.html#notices-header">Notices</a></div> <ul></ul> </li> </ul> </nav> <div id="resize-nav"></div> <nav id="search-results"> <h2>Search Results</h2> <ol></ol> </nav> <div id="contents-container"> <div id="breadcrumbs-container"> <div id="eqn-warning">This document includes math equations (highlighted in red) which are best viewed with <a target="_blank" href="https://www.mozilla.org/firefox">Firefox</a> version 4.0 or higher, or another <a target="_blank" href="http://www.w3.org/Math/Software/mathml_software_cat_browsers.html">MathML-aware browser</a>. There is also a <a href="../../pdf/CUDA_Math_API.pdf">PDF version of this document</a>. </div> <div id="breadcrumbs"><a href="group__CUDA__MATH__INTRINSIC__DOUBLE.html" shape="rect">< Previous</a> | <a href="group__CUDA__MATH__INTRINSIC__CAST.html" shape="rect">Next ></a></div> <div id="release-info">CUDA Math API (<a href="../../pdf/CUDA_Math_API.pdf">PDF</a>) - v6.5 (<a href="https://developer.nvidia.com/cuda-toolkit-archive">older</a>) - Last updated August 1, 2014 - <a href="mailto:cudatools@nvidia.com?subject=CUDA Toolkit Documentation Feedback: CUDA Math API">Send Feedback</a> - <span class="st_facebook"></span><span class="st_twitter"></span><span class="st_linkedin"></span><span class="st_reddit"></span><span class="st_slashdot"></span><span class="st_tumblr"></span><span class="st_sharethis"></span></div> </div> <article id="contents"> <div class="topic reference apiRef apiPackage cppModule" id="group__CUDA__MATH__INTRINSIC__INT"><a name="group__CUDA__MATH__INTRINSIC__INT" shape="rect"> <!-- --></a><h2 class="topictitle2 cppModule">1.6. Integer Intrinsics</h2> <div class="section"> <p>This section describes integer intrinsic functions that are only supported in device code. </p> </div> <h3 class="fake_sectiontitle member_header">Functions</h3> <dl class="members"> <dt><span class="member_long_type"><span class="keyword keyword apiItemName">__device__</span> unsigned int </span><span class="member_name_long_type"><a href="#group__CUDA__MATH__INTRINSIC__INT_1gc84ef1115946870edbcebddc0d539c5a" shape="rect">__brev</a> ( unsigned int <span> </span><span class="keyword keyword apiItemName">x</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Reverse the bit order of a 32 bit unsigned integer. </span></dd> <dt><span class="member_long_type"><span class="keyword keyword apiItemName">__device__</span> unsigned long long int </span><span class="member_name_long_type"><a href="#group__CUDA__MATH__INTRINSIC__INT_1g554354459699a11acfb072cf536974cd" shape="rect">__brevll</a> ( unsigned long long int<span> </span><span class="keyword keyword apiItemName">x</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Reverse the bit order of a 64 bit unsigned integer. </span></dd> <dt><span class="member_long_type"><span class="keyword keyword apiItemName">__device__</span> unsigned int </span><span class="member_name_long_type"><a href="#group__CUDA__MATH__INTRINSIC__INT_1g0b8b8156fe619205bf8d65acd8f29131" shape="rect">__byte_perm</a> ( unsigned int <span> </span><span class="keyword keyword apiItemName">x</span>, unsigned int <span> </span><span class="keyword keyword apiItemName">y</span>, unsigned int <span> </span><span class="keyword keyword apiItemName">s</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Return selected bytes from two 32 bit unsigned integers. </span></dd> <dt><span class="member_type"><span class="keyword keyword apiItemName">__device__</span> int </span><span class="member_name"><a href="#group__CUDA__MATH__INTRINSIC__INT_1gd45548f57952ed410fa5d824984f16d0" shape="rect">__clz</a> ( int <span> </span><span class="keyword keyword apiItemName">x</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Return the number of consecutive high-order zero bits in a 32 bit integer. </span></dd> <dt><span class="member_type"><span class="keyword keyword apiItemName">__device__</span> int </span><span class="member_name"><a href="#group__CUDA__MATH__INTRINSIC__INT_1g88ff76484edc65cafbef80e71a1daa53" shape="rect">__clzll</a> ( long long int<span> </span><span class="keyword keyword apiItemName">x</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Count the number of consecutive high-order zero bits in a 64 bit integer. </span></dd> <dt><span class="member_type"><span class="keyword keyword apiItemName">__device__</span> int </span><span class="member_name"><a href="#group__CUDA__MATH__INTRINSIC__INT_1gaf1eb22243e29e0b7222adee8ae7d4e4" shape="rect">__ffs</a> ( int <span> </span><span class="keyword keyword apiItemName">x</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Find the position of the least significant bit set to 1 in a 32 bit integer. </span></dd> <dt><span class="member_type"><span class="keyword keyword apiItemName">__device__</span> int </span><span class="member_name"><a href="#group__CUDA__MATH__INTRINSIC__INT_1gc42b0f1b68e9db038015d40a18d305df" shape="rect">__ffsll</a> ( long long int<span> </span><span class="keyword keyword apiItemName">x</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Find the position of the least significant bit set to 1 in a 64 bit integer. </span></dd> <dt><span class="member_type"><span class="keyword keyword apiItemName">__device__</span> int </span><span class="member_name"><a href="#group__CUDA__MATH__INTRINSIC__INT_1g6acbd5fd1fef78022471b58852e495da" shape="rect">__hadd</a> ( int , int ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Compute average of signed input arguments, avoiding overflow in the intermediate sum. </span></dd> <dt><span class="member_type"><span class="keyword keyword apiItemName">__device__</span> int </span><span class="member_name"><a href="#group__CUDA__MATH__INTRINSIC__INT_1gffff4cfc8958ec96329c11a797146573" shape="rect">__mul24</a> ( int <span> </span><span class="keyword keyword apiItemName">x</span>, int <span> </span><span class="keyword keyword apiItemName">y</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Calculate the least significant 32 bits of the product of the least significant 24 bits of two integers. </span></dd> <dt><span class="member_long_type"><span class="keyword keyword apiItemName">__device__</span> long long int </span><span class="member_name_long_type"><a href="#group__CUDA__MATH__INTRINSIC__INT_1g29b1d773d9393278aae147362827403b" shape="rect">__mul64hi</a> ( long long int<span> </span><span class="keyword keyword apiItemName">x</span>, long long int<span> </span><span class="keyword keyword apiItemName">y</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Calculate the most significant 64 bits of the product of the two 64 bit integers. </span></dd> <dt><span class="member_type"><span class="keyword keyword apiItemName">__device__</span> int </span><span class="member_name"><a href="#group__CUDA__MATH__INTRINSIC__INT_1gc3afa952add7894d6dda0931476d4882" shape="rect">__mulhi</a> ( int <span> </span><span class="keyword keyword apiItemName">x</span>, int <span> </span><span class="keyword keyword apiItemName">y</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Calculate the most significant 32 bits of the product of the two 32 bit integers. </span></dd> <dt><span class="member_type"><span class="keyword keyword apiItemName">__device__</span> int </span><span class="member_name"><a href="#group__CUDA__MATH__INTRINSIC__INT_1g43c9c7d2b9ebf202ff1ef5769989be46" shape="rect">__popc</a> ( unsigned int <span> </span><span class="keyword keyword apiItemName">x</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Count the number of bits that are set to 1 in a 32 bit integer. </span></dd> <dt><span class="member_type"><span class="keyword keyword apiItemName">__device__</span> int </span><span class="member_name"><a href="#group__CUDA__MATH__INTRINSIC__INT_1g6bb2f1cc3495f3f2ebe1df6ec52b3aec" shape="rect">__popcll</a> ( unsigned long long int<span> </span><span class="keyword keyword apiItemName">x</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Count the number of bits that are set to 1 in a 64 bit integer. </span></dd> <dt><span class="member_type"><span class="keyword keyword apiItemName">__device__</span> int </span><span class="member_name"><a href="#group__CUDA__MATH__INTRINSIC__INT_1gff2e17eb6a182d3f7547da33fc80042d" shape="rect">__rhadd</a> ( int , int ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Compute rounded average of signed input arguments, avoiding overflow in the intermediate sum. </span></dd> <dt><span class="member_long_type"><span class="keyword keyword apiItemName">__device__</span> unsigned int </span><span class="member_name_long_type"><a href="#group__CUDA__MATH__INTRINSIC__INT_1ge955ffc59084b5600dd5d223fb26beb0" shape="rect">__sad</a> ( int <span> </span><span class="keyword keyword apiItemName">x</span>, int <span> </span><span class="keyword keyword apiItemName">y</span>, unsigned int <span> </span><span class="keyword keyword apiItemName">z</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Calculate <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow class="MJX-TeXAtom-ORD"> <mo stretchy="false">|</mo> </mrow> <mi>x</mi> <mo>−</mo> <mi>y</mi> <mrow class="MJX-TeXAtom-ORD"> <mo stretchy="false">|</mo> </mrow> <mo>+</mo> <mi>z</mi> </math> , the sum of absolute difference. </span></dd> <dt><span class="member_long_type"><span class="keyword keyword apiItemName">__device__</span> unsigned int </span><span class="member_name_long_type"><a href="#group__CUDA__MATH__INTRINSIC__INT_1g3c4c147e4533393e5a9822364ada9986" shape="rect">__uhadd</a> ( unsigned<span> </span><span class="keyword keyword apiItemName">int</span>, unsigned<span> </span><span class="keyword keyword apiItemName">int</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Compute average of unsigned input arguments, avoiding overflow in the intermediate sum. </span></dd> <dt><span class="member_long_type"><span class="keyword keyword apiItemName">__device__</span> unsigned int </span><span class="member_name_long_type"><a href="#group__CUDA__MATH__INTRINSIC__INT_1g2b1446551e854d164e3d4aae25f94a3f" shape="rect">__umul24</a> ( unsigned int <span> </span><span class="keyword keyword apiItemName">x</span>, unsigned int <span> </span><span class="keyword keyword apiItemName">y</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Calculate the least significant 32 bits of the product of the least significant 24 bits of two unsigned integers. </span></dd> <dt><span class="member_long_type"><span class="keyword keyword apiItemName">__device__</span> unsigned long long int </span><span class="member_name_long_type"><a href="#group__CUDA__MATH__INTRINSIC__INT_1gefaf2a1bb2ad8986b2c248b74461e12e" shape="rect">__umul64hi</a> ( unsigned long long int<span> </span><span class="keyword keyword apiItemName">x</span>, unsigned long long int<span> </span><span class="keyword keyword apiItemName">y</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Calculate the most significant 64 bits of the product of the two 64 unsigned bit integers. </span></dd> <dt><span class="member_long_type"><span class="keyword keyword apiItemName">__device__</span> unsigned int </span><span class="member_name_long_type"><a href="#group__CUDA__MATH__INTRINSIC__INT_1g2ea43def3122a1bfb3eb8271a59f4470" shape="rect">__umulhi</a> ( unsigned int <span> </span><span class="keyword keyword apiItemName">x</span>, unsigned int <span> </span><span class="keyword keyword apiItemName">y</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Calculate the most significant 32 bits of the product of the two 32 bit unsigned integers. </span></dd> <dt><span class="member_long_type"><span class="keyword keyword apiItemName">__device__</span> unsigned int </span><span class="member_name_long_type"><a href="#group__CUDA__MATH__INTRINSIC__INT_1g8de7a191b520ac2ff5d3836d68aa3481" shape="rect">__urhadd</a> ( unsigned<span> </span><span class="keyword keyword apiItemName">int</span>, unsigned<span> </span><span class="keyword keyword apiItemName">int</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Compute rounded average of unsigned input arguments, avoiding overflow in the intermediate sum. </span></dd> <dt><span class="member_long_type"><span class="keyword keyword apiItemName">__device__</span> unsigned int </span><span class="member_name_long_type"><a href="#group__CUDA__MATH__INTRINSIC__INT_1g58e819af40fc4a3e9e9c3a4c13cbd0e2" shape="rect">__usad</a> ( unsigned int <span> </span><span class="keyword keyword apiItemName">x</span>, unsigned int <span> </span><span class="keyword keyword apiItemName">y</span>, unsigned int <span> </span><span class="keyword keyword apiItemName">z</span> ) </span></dt> <dd class="shortdesc"><span></span><span class="desc">Calculate <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow class="MJX-TeXAtom-ORD"> <mo stretchy="false">|</mo> </mrow> <mi>x</mi> <mo>−</mo> <mi>y</mi> <mrow class="MJX-TeXAtom-ORD"> <mo stretchy="false">|</mo> </mrow> <mo>+</mo> <mi>z</mi> </math> , the sum of absolute difference. </span></dd> </dl> <div class="description"> <h3 class="sectiontitle">Functions</h3> <dl class="description"> <dt class="description"><a name="group__CUDA__MATH__INTRINSIC__INT_1gc84ef1115946870edbcebddc0d539c5a" id="group__CUDA__MATH__INTRINSIC__INT_1gc84ef1115946870edbcebddc0d539c5a" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__device__</span> unsigned int __brev ( unsigned int <span> </span><span class="keyword keyword apiItemName">x</span> ) </span></dt> <dd class="description"> <div class="section">Reverse the bit order of a 32 bit unsigned integer. </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return">Returns the bit-reversed value of <tt class="ph tt code">x</tt>. i.e. bit N of the return value corresponds to bit 31-N of <tt class="ph tt code">x</tt>. </p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Reverses the bit order of the 32 bit unsigned integer <tt class="ph tt code">x</tt>. </p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDA__MATH__INTRINSIC__INT_1g554354459699a11acfb072cf536974cd" id="group__CUDA__MATH__INTRINSIC__INT_1g554354459699a11acfb072cf536974cd" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__device__</span> unsigned long long int __brevll ( unsigned long long int<span> </span><span class="keyword keyword apiItemName">x</span> ) </span></dt> <dd class="description"> <div class="section">Reverse the bit order of a 64 bit unsigned integer. </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return">Returns the bit-reversed value of <tt class="ph tt code">x</tt>. i.e. bit N of the return value corresponds to bit 63-N of <tt class="ph tt code">x</tt>. </p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Reverses the bit order of the 64 bit unsigned integer <tt class="ph tt code">x</tt>. </p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDA__MATH__INTRINSIC__INT_1g0b8b8156fe619205bf8d65acd8f29131" id="group__CUDA__MATH__INTRINSIC__INT_1g0b8b8156fe619205bf8d65acd8f29131" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__device__</span> unsigned int __byte_perm ( unsigned int <span> </span><span class="keyword keyword apiItemName">x</span>, unsigned int <span> </span><span class="keyword keyword apiItemName">y</span>, unsigned int <span> </span><span class="keyword keyword apiItemName">s</span> ) </span></dt> <dd class="description"> <div class="section">Return selected bytes from two 32 bit unsigned integers. </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return">The returned value r is computed to be: <tt class="ph tt code">result[n] := input[selector[n]]</tt> where <tt class="ph tt code">result[n]</tt> is the nth byte of r. </p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>byte_perm(x,y,s) returns a 32-bit integer consisting of four bytes from eight input bytes provided in the two input integers <tt class="ph tt code">x</tt> and <tt class="ph tt code">y</tt>, as specified by a selector, <tt class="ph tt code">s</tt>. </p> <p class="p">The input bytes are indexed as follows: input[0] = x<7:0> input[1] = x<15:8> input[2] = x<23:16> input[3] = x<31:24> input[4] = y<7:0> input[5] = y<15:8> input[6] = y<23:16> input[7] = y<31:24> The selector indices are as follows (the upper 16-bits of the selector are not used): selector[0] = s<2:0> selector[1] = s<6:4> selector[2] = s<10:8> selector[3] = s<14:12> </p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDA__MATH__INTRINSIC__INT_1gd45548f57952ed410fa5d824984f16d0" id="group__CUDA__MATH__INTRINSIC__INT_1gd45548f57952ed410fa5d824984f16d0" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__device__</span> int __clz ( int <span> </span><span class="keyword keyword apiItemName">x</span> ) </span></dt> <dd class="description"> <div class="section">Return the number of consecutive high-order zero bits in a 32 bit integer. </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return">Returns a value between 0 and 32 inclusive representing the number of zero bits. </p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Count the number of consecutive leading zero bits, starting at the most significant bit (bit 31) of <tt class="ph tt code">x</tt>. </p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDA__MATH__INTRINSIC__INT_1g88ff76484edc65cafbef80e71a1daa53" id="group__CUDA__MATH__INTRINSIC__INT_1g88ff76484edc65cafbef80e71a1daa53" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__device__</span> int __clzll ( long long int<span> </span><span class="keyword keyword apiItemName">x</span> ) </span></dt> <dd class="description"> <div class="section">Count the number of consecutive high-order zero bits in a 64 bit integer. </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return">Returns a value between 0 and 64 inclusive representing the number of zero bits. </p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Count the number of consecutive leading zero bits, starting at the most significant bit (bit 63) of <tt class="ph tt code">x</tt>. </p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDA__MATH__INTRINSIC__INT_1gaf1eb22243e29e0b7222adee8ae7d4e4" id="group__CUDA__MATH__INTRINSIC__INT_1gaf1eb22243e29e0b7222adee8ae7d4e4" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__device__</span> int __ffs ( int <span> </span><span class="keyword keyword apiItemName">x</span> ) </span></dt> <dd class="description"> <div class="section">Find the position of the least significant bit set to 1 in a 32 bit integer. </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return">Returns a value between 0 and 32 inclusive representing the position of the first bit set. <ul> <li>__ffs(0) returns 0. </li> </ul> </p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Find the position of the first (least significant) bit set to 1 in <tt class="ph tt code">x</tt>, where the least significant bit position is 1. </p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDA__MATH__INTRINSIC__INT_1gc42b0f1b68e9db038015d40a18d305df" id="group__CUDA__MATH__INTRINSIC__INT_1gc42b0f1b68e9db038015d40a18d305df" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__device__</span> int __ffsll ( long long int<span> </span><span class="keyword keyword apiItemName">x</span> ) </span></dt> <dd class="description"> <div class="section">Find the position of the least significant bit set to 1 in a 64 bit integer. </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return">Returns a value between 0 and 64 inclusive representing the position of the first bit set. <ul> <li>__ffsll(0) returns 0. </li> </ul> </p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Find the position of the first (least significant) bit set to 1 in <tt class="ph tt code">x</tt>, where the least significant bit position is 1. </p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDA__MATH__INTRINSIC__INT_1g6acbd5fd1fef78022471b58852e495da" id="group__CUDA__MATH__INTRINSIC__INT_1g6acbd5fd1fef78022471b58852e495da" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__device__</span> int __hadd ( int , int ) </span></dt> <dd class="description"> <div class="section">Compute average of signed input arguments, avoiding overflow in the intermediate sum. </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return">Returns a signed integer value representing the signed average value of the two inputs. </p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Compute average of signed input arguments <tt class="ph tt code">x</tt> and <tt class="ph tt code">y</tt> as ( <tt class="ph tt code">x</tt> + <tt class="ph tt code">y</tt> ) >> 1, avoiding overflow in the intermediate sum. </p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDA__MATH__INTRINSIC__INT_1gffff4cfc8958ec96329c11a797146573" id="group__CUDA__MATH__INTRINSIC__INT_1gffff4cfc8958ec96329c11a797146573" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__device__</span> int __mul24 ( int <span> </span><span class="keyword keyword apiItemName">x</span>, int <span> </span><span class="keyword keyword apiItemName">y</span> ) </span></dt> <dd class="description"> <div class="section">Calculate the least significant 32 bits of the product of the least significant 24 bits of two integers. </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return">Returns the least significant 32 bits of the product <tt class="ph tt code">x</tt> * <tt class="ph tt code">y</tt>. </p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Calculate the least significant 32 bits of the product of the least significant 24 bits of <tt class="ph tt code">x</tt> and <tt class="ph tt code">y</tt>. The high order 8 bits of <tt class="ph tt code">x</tt> and <tt class="ph tt code">y</tt> are ignored. </p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDA__MATH__INTRINSIC__INT_1g29b1d773d9393278aae147362827403b" id="group__CUDA__MATH__INTRINSIC__INT_1g29b1d773d9393278aae147362827403b" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__device__</span> long long int __mul64hi ( long long int<span> </span><span class="keyword keyword apiItemName">x</span>, long long int<span> </span><span class="keyword keyword apiItemName">y</span> ) </span></dt> <dd class="description"> <div class="section">Calculate the most significant 64 bits of the product of the two 64 bit integers. </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return">Returns the most significant 64 bits of the product <tt class="ph tt code">x</tt> * <tt class="ph tt code">y</tt>. </p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Calculate the most significant 64 bits of the 128-bit product <tt class="ph tt code">x</tt> * <tt class="ph tt code">y</tt>, where <tt class="ph tt code">x</tt> and <tt class="ph tt code">y</tt> are 64-bit integers. </p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDA__MATH__INTRINSIC__INT_1gc3afa952add7894d6dda0931476d4882" id="group__CUDA__MATH__INTRINSIC__INT_1gc3afa952add7894d6dda0931476d4882" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__device__</span> int __mulhi ( int <span> </span><span class="keyword keyword apiItemName">x</span>, int <span> </span><span class="keyword keyword apiItemName">y</span> ) </span></dt> <dd class="description"> <div class="section">Calculate the most significant 32 bits of the product of the two 32 bit integers. </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return">Returns the most significant 32 bits of the product <tt class="ph tt code">x</tt> * <tt class="ph tt code">y</tt>. </p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Calculate the most significant 32 bits of the 64-bit product <tt class="ph tt code">x</tt> * <tt class="ph tt code">y</tt>, where <tt class="ph tt code">x</tt> and <tt class="ph tt code">y</tt> are 32-bit integers. </p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDA__MATH__INTRINSIC__INT_1g43c9c7d2b9ebf202ff1ef5769989be46" id="group__CUDA__MATH__INTRINSIC__INT_1g43c9c7d2b9ebf202ff1ef5769989be46" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__device__</span> int __popc ( unsigned int <span> </span><span class="keyword keyword apiItemName">x</span> ) </span></dt> <dd class="description"> <div class="section">Count the number of bits that are set to 1 in a 32 bit integer. </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return">Returns a value between 0 and 32 inclusive representing the number of set bits. </p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Count the number of bits that are set to 1 in <tt class="ph tt code">x</tt>. </p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDA__MATH__INTRINSIC__INT_1g6bb2f1cc3495f3f2ebe1df6ec52b3aec" id="group__CUDA__MATH__INTRINSIC__INT_1g6bb2f1cc3495f3f2ebe1df6ec52b3aec" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__device__</span> int __popcll ( unsigned long long int<span> </span><span class="keyword keyword apiItemName">x</span> ) </span></dt> <dd class="description"> <div class="section">Count the number of bits that are set to 1 in a 64 bit integer. </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return">Returns a value between 0 and 64 inclusive representing the number of set bits. </p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Count the number of bits that are set to 1 in <tt class="ph tt code">x</tt>. </p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDA__MATH__INTRINSIC__INT_1gff2e17eb6a182d3f7547da33fc80042d" id="group__CUDA__MATH__INTRINSIC__INT_1gff2e17eb6a182d3f7547da33fc80042d" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__device__</span> int __rhadd ( int , int ) </span></dt> <dd class="description"> <div class="section">Compute rounded average of signed input arguments, avoiding overflow in the intermediate sum. </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return">Returns a signed integer value representing the signed rounded average value of the two inputs. </p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Compute average of signed input arguments <tt class="ph tt code">x</tt> and <tt class="ph tt code">y</tt> as ( <tt class="ph tt code">x</tt> + <tt class="ph tt code">y</tt> + 1 ) >> 1, avoiding overflow in the intermediate sum. </p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDA__MATH__INTRINSIC__INT_1ge955ffc59084b5600dd5d223fb26beb0" id="group__CUDA__MATH__INTRINSIC__INT_1ge955ffc59084b5600dd5d223fb26beb0" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__device__</span> unsigned int __sad ( int <span> </span><span class="keyword keyword apiItemName">x</span>, int <span> </span><span class="keyword keyword apiItemName">y</span>, unsigned int <span> </span><span class="keyword keyword apiItemName">z</span> ) </span></dt> <dd class="description"> <div class="section">Calculate <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow class="MJX-TeXAtom-ORD"> <mo stretchy="false">|</mo> </mrow> <mi>x</mi> <mo>−</mo> <mi>y</mi> <mrow class="MJX-TeXAtom-ORD"> <mo stretchy="false">|</mo> </mrow> <mo>+</mo> <mi>z</mi> </math> , the sum of absolute difference. </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return">Returns <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow class="MJX-TeXAtom-ORD"> <mo stretchy="false">|</mo> </mrow> <mi>x</mi> <mo>−</mo> <mi>y</mi> <mrow class="MJX-TeXAtom-ORD"> <mo stretchy="false">|</mo> </mrow> <mo>+</mo> <mi>z</mi> </math> . </p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Calculate <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow class="MJX-TeXAtom-ORD"> <mo stretchy="false">|</mo> </mrow> <mi>x</mi> <mo>−</mo> <mi>y</mi> <mrow class="MJX-TeXAtom-ORD"> <mo stretchy="false">|</mo> </mrow> <mo>+</mo> <mi>z</mi> </math> , the 32-bit sum of the third argument <tt class="ph tt code">z</tt> plus and the absolute value of the difference between the first argument, <tt class="ph tt code">x</tt>, and second argument, <tt class="ph tt code">y</tt>. </p> <p class="p">Inputs <tt class="ph tt code">x</tt> and <tt class="ph tt code">y</tt> are signed 32-bit integers, input <tt class="ph tt code">z</tt> is a 32-bit unsigned integer. </p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDA__MATH__INTRINSIC__INT_1g3c4c147e4533393e5a9822364ada9986" id="group__CUDA__MATH__INTRINSIC__INT_1g3c4c147e4533393e5a9822364ada9986" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__device__</span> unsigned int __uhadd ( unsigned<span> </span><span class="keyword keyword apiItemName">int</span>, unsigned<span> </span><span class="keyword keyword apiItemName">int</span> ) </span></dt> <dd class="description"> <div class="section">Compute average of unsigned input arguments, avoiding overflow in the intermediate sum. </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return">Returns an unsigned integer value representing the unsigned average value of the two inputs. </p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Compute average of unsigned input arguments <tt class="ph tt code">x</tt> and <tt class="ph tt code">y</tt> as ( <tt class="ph tt code">x</tt> + <tt class="ph tt code">y</tt> ) >> 1, avoiding overflow in the intermediate sum. </p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDA__MATH__INTRINSIC__INT_1g2b1446551e854d164e3d4aae25f94a3f" id="group__CUDA__MATH__INTRINSIC__INT_1g2b1446551e854d164e3d4aae25f94a3f" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__device__</span> unsigned int __umul24 ( unsigned int <span> </span><span class="keyword keyword apiItemName">x</span>, unsigned int <span> </span><span class="keyword keyword apiItemName">y</span> ) </span></dt> <dd class="description"> <div class="section">Calculate the least significant 32 bits of the product of the least significant 24 bits of two unsigned integers. </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return">Returns the least significant 32 bits of the product <tt class="ph tt code">x</tt> * <tt class="ph tt code">y</tt>. </p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Calculate the least significant 32 bits of the product of the least significant 24 bits of <tt class="ph tt code">x</tt> and <tt class="ph tt code">y</tt>. The high order 8 bits of <tt class="ph tt code">x</tt> and <tt class="ph tt code">y</tt> are ignored. </p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDA__MATH__INTRINSIC__INT_1gefaf2a1bb2ad8986b2c248b74461e12e" id="group__CUDA__MATH__INTRINSIC__INT_1gefaf2a1bb2ad8986b2c248b74461e12e" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__device__</span> unsigned long long int __umul64hi ( unsigned long long int<span> </span><span class="keyword keyword apiItemName">x</span>, unsigned long long int<span> </span><span class="keyword keyword apiItemName">y</span> ) </span></dt> <dd class="description"> <div class="section">Calculate the most significant 64 bits of the product of the two 64 unsigned bit integers. </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return">Returns the most significant 64 bits of the product <tt class="ph tt code">x</tt> * <tt class="ph tt code">y</tt>. </p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Calculate the most significant 64 bits of the 128-bit product <tt class="ph tt code">x</tt> * <tt class="ph tt code">y</tt>, where <tt class="ph tt code">x</tt> and <tt class="ph tt code">y</tt> are 64-bit unsigned integers. </p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDA__MATH__INTRINSIC__INT_1g2ea43def3122a1bfb3eb8271a59f4470" id="group__CUDA__MATH__INTRINSIC__INT_1g2ea43def3122a1bfb3eb8271a59f4470" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__device__</span> unsigned int __umulhi ( unsigned int <span> </span><span class="keyword keyword apiItemName">x</span>, unsigned int <span> </span><span class="keyword keyword apiItemName">y</span> ) </span></dt> <dd class="description"> <div class="section">Calculate the most significant 32 bits of the product of the two 32 bit unsigned integers. </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return">Returns the most significant 32 bits of the product <tt class="ph tt code">x</tt> * <tt class="ph tt code">y</tt>. </p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Calculate the most significant 32 bits of the 64-bit product <tt class="ph tt code">x</tt> * <tt class="ph tt code">y</tt>, where <tt class="ph tt code">x</tt> and <tt class="ph tt code">y</tt> are 32-bit unsigned integers. </p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDA__MATH__INTRINSIC__INT_1g8de7a191b520ac2ff5d3836d68aa3481" id="group__CUDA__MATH__INTRINSIC__INT_1g8de7a191b520ac2ff5d3836d68aa3481" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__device__</span> unsigned int __urhadd ( unsigned<span> </span><span class="keyword keyword apiItemName">int</span>, unsigned<span> </span><span class="keyword keyword apiItemName">int</span> ) </span></dt> <dd class="description"> <div class="section">Compute rounded average of unsigned input arguments, avoiding overflow in the intermediate sum. </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return">Returns an unsigned integer value representing the unsigned rounded average value of the two inputs. </p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Compute average of unsigned input arguments <tt class="ph tt code">x</tt> and <tt class="ph tt code">y</tt> as ( <tt class="ph tt code">x</tt> + <tt class="ph tt code">y</tt> + 1 ) >> 1, avoiding overflow in the intermediate sum. </p> <p class="p"></p> </div> </dd> <dt class="description"><a name="group__CUDA__MATH__INTRINSIC__INT_1g58e819af40fc4a3e9e9c3a4c13cbd0e2" id="group__CUDA__MATH__INTRINSIC__INT_1g58e819af40fc4a3e9e9c3a4c13cbd0e2" shape="rect"> <!-- --></a><span><span class="keyword keyword apiItemName">__device__</span> unsigned int __usad ( unsigned int <span> </span><span class="keyword keyword apiItemName">x</span>, unsigned int <span> </span><span class="keyword keyword apiItemName">y</span>, unsigned int <span> </span><span class="keyword keyword apiItemName">z</span> ) </span></dt> <dd class="description"> <div class="section">Calculate <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow class="MJX-TeXAtom-ORD"> <mo stretchy="false">|</mo> </mrow> <mi>x</mi> <mo>−</mo> <mi>y</mi> <mrow class="MJX-TeXAtom-ORD"> <mo stretchy="false">|</mo> </mrow> <mo>+</mo> <mi>z</mi> </math> , the sum of absolute difference. </div> <div class="section"> <h6 class="return_header">Returns</h6> <p class="return">Returns <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow class="MJX-TeXAtom-ORD"> <mo stretchy="false">|</mo> </mrow> <mi>x</mi> <mo>−</mo> <mi>y</mi> <mrow class="MJX-TeXAtom-ORD"> <mo stretchy="false">|</mo> </mrow> <mo>+</mo> <mi>z</mi> </math> . </p> </div> <div class="section"> <h6 class="description_header">Description</h6> <p>Calculate <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow class="MJX-TeXAtom-ORD"> <mo stretchy="false">|</mo> </mrow> <mi>x</mi> <mo>−</mo> <mi>y</mi> <mrow class="MJX-TeXAtom-ORD"> <mo stretchy="false">|</mo> </mrow> <mo>+</mo> <mi>z</mi> </math> , the 32-bit sum of the third argument <tt class="ph tt code">z</tt> plus and the absolute value of the difference between the first argument, <tt class="ph tt code">x</tt>, and second argument, <tt class="ph tt code">y</tt>. </p> <p class="p">Inputs <tt class="ph tt code">x</tt>, <tt class="ph tt code">y</tt>, and <tt class="ph tt code">z</tt> are unsigned 32-bit integers. </p> <p class="p"></p> </div> </dd> </dl> </div> </div> <hr id="contents-end"></hr> </article> </div> </div> <script language="JavaScript" type="text/javascript" charset="utf-8" src="../common/formatting/common.min.js"></script> <script language="JavaScript" type="text/javascript" charset="utf-8" src="../common/scripts/google-analytics/google-analytics-write.js"></script> <script language="JavaScript" type="text/javascript" charset="utf-8" src="../common/scripts/google-analytics/google-analytics-tracker.js"></script> <script type="text/javascript">var switchTo5x=true;</script><script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script><script type="text/javascript">stLight.options({publisher: "998dc202-a267-4d8e-bce9-14debadb8d92", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script></body> </html>