Tue, 29 Oct 2024 16:08:37 +0100
add cast from size_t to unsigned to avoid warnings from certain compilers
<!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"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.13"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>ucx: /home/mike/workspace/c/ucx/src/ucx/ucx.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectlogo"><img alt="Logo" src="uaplogo.png"/></td> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">ucx </div> <div id="projectbrief">UAP Common Extensions</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.13 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); </script> <div id="main-nav"></div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_69f4ea29401808fe6229564976cde3ce.html">ucx</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#define-members">Macros</a> | <a href="#typedef-members">Typedefs</a> | <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">ucx.h File Reference</div> </div> </div><!--header--> <div class="contents"> <p>Main UCX Header providing most common definitions. <a href="#details">More...</a></p> <div class="textblock"><code>#include <stdlib.h></code><br /> <code>#include <stdint.h></code><br /> <code>#include <sys/types.h></code><br /> </div> <p><a href="ucx_8h_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a> Macros</h2></td></tr> <tr class="memitem:aa57e5dd22d42387d748cc16777df1383"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="ucx_8h.html#aa57e5dd22d42387d748cc16777df1383">UCX_VERSION_MAJOR</a>   2</td></tr> <tr class="memdesc:aa57e5dd22d42387d748cc16777df1383"><td class="mdescLeft"> </td><td class="mdescRight">Major UCX version as integer constant. <a href="#aa57e5dd22d42387d748cc16777df1383">More...</a><br /></td></tr> <tr class="separator:aa57e5dd22d42387d748cc16777df1383"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a9ac10d6353e23d4615a87fc737c65eb0"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="ucx_8h.html#a9ac10d6353e23d4615a87fc737c65eb0">UCX_VERSION_MINOR</a>   1</td></tr> <tr class="memdesc:a9ac10d6353e23d4615a87fc737c65eb0"><td class="mdescLeft"> </td><td class="mdescRight">Minor UCX version as integer constant. <a href="#a9ac10d6353e23d4615a87fc737c65eb0">More...</a><br /></td></tr> <tr class="separator:a9ac10d6353e23d4615a87fc737c65eb0"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:af12001920ca2fc1405615684e4dea284"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="ucx_8h.html#af12001920ca2fc1405615684e4dea284">UCX_VERSION</a>   (((<a class="el" href="ucx_8h.html#aa57e5dd22d42387d748cc16777df1383">UCX_VERSION_MAJOR</a>)<<16)|<a class="el" href="ucx_8h.html#a9ac10d6353e23d4615a87fc737c65eb0">UCX_VERSION_MINOR</a>)</td></tr> <tr class="memdesc:af12001920ca2fc1405615684e4dea284"><td class="mdescLeft"> </td><td class="mdescRight">Version constant which ensures to increase monotonically. <a href="#af12001920ca2fc1405615684e4dea284">More...</a><br /></td></tr> <tr class="separator:af12001920ca2fc1405615684e4dea284"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a0b5ed6c1a0b15356f4f948acfd32a4cc"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="ucx_8h.html#a0b5ed6c1a0b15356f4f948acfd32a4cc">ucx_szmul</a>(a, b, result)   <a class="el" href="ucx_8h.html#a6637171cc0ec097b297f731a3036dd3b">ucx_szmul_impl</a>(a, b, result)</td></tr> <tr class="memdesc:a0b5ed6c1a0b15356f4f948acfd32a4cc"><td class="mdescLeft"> </td><td class="mdescRight">Performs a multiplication of size_t values and checks for overflow. <a href="#a0b5ed6c1a0b15356f4f948acfd32a4cc">More...</a><br /></td></tr> <tr class="separator:a0b5ed6c1a0b15356f4f948acfd32a4cc"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a> Typedefs</h2></td></tr> <tr class="memitem:ad2b370c2809914c8b7fedab163c266b3"><td class="memItemLeft" align="right" valign="top">typedef void(* </td><td class="memItemRight" valign="bottom"><a class="el" href="ucx_8h.html#ad2b370c2809914c8b7fedab163c266b3">ucx_destructor</a>) (void *)</td></tr> <tr class="memdesc:ad2b370c2809914c8b7fedab163c266b3"><td class="mdescLeft"> </td><td class="mdescRight">A function pointer to a destructor function. <a href="#ad2b370c2809914c8b7fedab163c266b3">More...</a><br /></td></tr> <tr class="separator:ad2b370c2809914c8b7fedab163c266b3"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:afe5e2d5dbf34778e0e97852051570791"><td class="memItemLeft" align="right" valign="top">typedef int(* </td><td class="memItemRight" valign="bottom"><a class="el" href="ucx_8h.html#afe5e2d5dbf34778e0e97852051570791">cmp_func</a>) (const void *, const void *, void *)</td></tr> <tr class="memdesc:afe5e2d5dbf34778e0e97852051570791"><td class="mdescLeft"> </td><td class="mdescRight">Function pointer to a compare function. <a href="#afe5e2d5dbf34778e0e97852051570791">More...</a><br /></td></tr> <tr class="separator:afe5e2d5dbf34778e0e97852051570791"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a0bc5bf89e556c1d45d10863d52728ac9"><td class="memItemLeft" align="right" valign="top">typedef intmax_t(* </td><td class="memItemRight" valign="bottom"><a class="el" href="ucx_8h.html#a0bc5bf89e556c1d45d10863d52728ac9">distance_func</a>) (const void *, const void *, void *)</td></tr> <tr class="memdesc:a0bc5bf89e556c1d45d10863d52728ac9"><td class="mdescLeft"> </td><td class="mdescRight">Function pointer to a distance function. <a href="#a0bc5bf89e556c1d45d10863d52728ac9">More...</a><br /></td></tr> <tr class="separator:a0bc5bf89e556c1d45d10863d52728ac9"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:aab917a5fe0965673c73e8ebd0a1fc967"><td class="memItemLeft" align="right" valign="top">typedef void *(* </td><td class="memItemRight" valign="bottom"><a class="el" href="ucx_8h.html#aab917a5fe0965673c73e8ebd0a1fc967">copy_func</a>) (const void *, void *)</td></tr> <tr class="memdesc:aab917a5fe0965673c73e8ebd0a1fc967"><td class="mdescLeft"> </td><td class="mdescRight">Function pointer to a copy function. <a href="#aab917a5fe0965673c73e8ebd0a1fc967">More...</a><br /></td></tr> <tr class="separator:aab917a5fe0965673c73e8ebd0a1fc967"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a989b3f0fa4d307d278378fde435641ed"><td class="memItemLeft" align="right" valign="top">typedef size_t(* </td><td class="memItemRight" valign="bottom"><a class="el" href="ucx_8h.html#a989b3f0fa4d307d278378fde435641ed">write_func</a>) (const void *, size_t, size_t, void *)</td></tr> <tr class="memdesc:a989b3f0fa4d307d278378fde435641ed"><td class="mdescLeft"> </td><td class="mdescRight">Function pointer to a write function. <a href="#a989b3f0fa4d307d278378fde435641ed">More...</a><br /></td></tr> <tr class="separator:a989b3f0fa4d307d278378fde435641ed"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a6a67e255e460acb58f802067b3ff5fd5"><td class="memItemLeft" align="right" valign="top">typedef size_t(* </td><td class="memItemRight" valign="bottom"><a class="el" href="ucx_8h.html#a6a67e255e460acb58f802067b3ff5fd5">read_func</a>) (void *, size_t, size_t, void *)</td></tr> <tr class="memdesc:a6a67e255e460acb58f802067b3ff5fd5"><td class="mdescLeft"> </td><td class="mdescRight">Function pointer to a read function. <a href="#a6a67e255e460acb58f802067b3ff5fd5">More...</a><br /></td></tr> <tr class="separator:a6a67e255e460acb58f802067b3ff5fd5"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:a6637171cc0ec097b297f731a3036dd3b"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="ucx_8h.html#a6637171cc0ec097b297f731a3036dd3b">ucx_szmul_impl</a> (size_t a, size_t b, size_t *result)</td></tr> <tr class="memdesc:a6637171cc0ec097b297f731a3036dd3b"><td class="mdescLeft"> </td><td class="mdescRight">Performs a multiplication of size_t values and checks for overflow. <a href="#a6637171cc0ec097b297f731a3036dd3b">More...</a><br /></td></tr> <tr class="separator:a6637171cc0ec097b297f731a3036dd3b"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p>Main UCX Header providing most common definitions. </p> <dl class="section author"><dt>Author</dt><dd>Mike Becker </dd> <dd> Olaf Wintermann </dd></dl> </div><h2 class="groupheader">Macro Definition Documentation</h2> <a id="a0b5ed6c1a0b15356f4f948acfd32a4cc"></a> <h2 class="memtitle"><span class="permalink"><a href="#a0b5ed6c1a0b15356f4f948acfd32a4cc">◆ </a></span>ucx_szmul</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define ucx_szmul</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname">a, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname">b, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname">result </td> </tr> <tr> <td></td> <td>)</td> <td></td><td>   <a class="el" href="ucx_8h.html#a6637171cc0ec097b297f731a3036dd3b">ucx_szmul_impl</a>(a, b, result)</td> </tr> </table> </div><div class="memdoc"> <p>Performs a multiplication of size_t values and checks for overflow. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">a</td><td>first operand </td></tr> <tr><td class="paramname">b</td><td>second operand </td></tr> <tr><td class="paramname">result</td><td>a pointer to a size_t, where the result should be stored </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>zero, if no overflow occurred and the result is correct, non-zero otherwise </dd></dl> </div> </div> <a id="af12001920ca2fc1405615684e4dea284"></a> <h2 class="memtitle"><span class="permalink"><a href="#af12001920ca2fc1405615684e4dea284">◆ </a></span>UCX_VERSION</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define UCX_VERSION   (((<a class="el" href="ucx_8h.html#aa57e5dd22d42387d748cc16777df1383">UCX_VERSION_MAJOR</a>)<<16)|<a class="el" href="ucx_8h.html#a9ac10d6353e23d4615a87fc737c65eb0">UCX_VERSION_MINOR</a>)</td> </tr> </table> </div><div class="memdoc"> <p>Version constant which ensures to increase monotonically. </p> </div> </div> <a id="aa57e5dd22d42387d748cc16777df1383"></a> <h2 class="memtitle"><span class="permalink"><a href="#aa57e5dd22d42387d748cc16777df1383">◆ </a></span>UCX_VERSION_MAJOR</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define UCX_VERSION_MAJOR   2</td> </tr> </table> </div><div class="memdoc"> <p>Major UCX version as integer constant. </p> </div> </div> <a id="a9ac10d6353e23d4615a87fc737c65eb0"></a> <h2 class="memtitle"><span class="permalink"><a href="#a9ac10d6353e23d4615a87fc737c65eb0">◆ </a></span>UCX_VERSION_MINOR</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define UCX_VERSION_MINOR   1</td> </tr> </table> </div><div class="memdoc"> <p>Minor UCX version as integer constant. </p> </div> </div> <h2 class="groupheader">Typedef Documentation</h2> <a id="afe5e2d5dbf34778e0e97852051570791"></a> <h2 class="memtitle"><span class="permalink"><a href="#afe5e2d5dbf34778e0e97852051570791">◆ </a></span>cmp_func</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef int(* cmp_func) (const void *, const void *, void *)</td> </tr> </table> </div><div class="memdoc"> <p>Function pointer to a compare function. </p> <p>The compare function shall take three arguments: the two values that shall be compared and optional additional data. The function shall then return -1 if the first argument is less than the second argument, 1 if the first argument is greater than the second argument and 0 if both arguments are equal. If the third argument is <code>NULL</code>, it shall be ignored. </p> </div> </div> <a id="aab917a5fe0965673c73e8ebd0a1fc967"></a> <h2 class="memtitle"><span class="permalink"><a href="#aab917a5fe0965673c73e8ebd0a1fc967">◆ </a></span>copy_func</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef void*(* copy_func) (const void *, void *)</td> </tr> </table> </div><div class="memdoc"> <p>Function pointer to a copy function. </p> <p>The copy function shall create a copy of the first argument and may use additional data provided by the second argument. If the second argument is <code>NULL</code>, it shall be ignored.</p> <p><b>Attention:</b> if pointers returned by functions of this type may be passed to <code>free()</code> depends on the implementation of the respective <code>copy_func</code>. </p> </div> </div> <a id="a0bc5bf89e556c1d45d10863d52728ac9"></a> <h2 class="memtitle"><span class="permalink"><a href="#a0bc5bf89e556c1d45d10863d52728ac9">◆ </a></span>distance_func</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef intmax_t(* distance_func) (const void *, const void *, void *)</td> </tr> </table> </div><div class="memdoc"> <p>Function pointer to a distance function. </p> <p>The distance function shall take three arguments: the two values for which the distance shall be computed and optional additional data. The function shall then return the signed distance as integer value. </p> </div> </div> <a id="a6a67e255e460acb58f802067b3ff5fd5"></a> <h2 class="memtitle"><span class="permalink"><a href="#a6a67e255e460acb58f802067b3ff5fd5">◆ </a></span>read_func</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef size_t(* read_func) (void *, size_t, size_t, void *)</td> </tr> </table> </div><div class="memdoc"> <p>Function pointer to a read function. </p> <p>The signature of the read function shall be compatible to the signature of standard <code>fread</code>, though it may use arbitrary data types for source and destination.</p> <p>The arguments shall contain (in ascending order): a pointer to the destination, the length of one element, the element count and a pointer to the source. </p> </div> </div> <a id="ad2b370c2809914c8b7fedab163c266b3"></a> <h2 class="memtitle"><span class="permalink"><a href="#ad2b370c2809914c8b7fedab163c266b3">◆ </a></span>ucx_destructor</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef void(* ucx_destructor) (void *)</td> </tr> </table> </div><div class="memdoc"> <p>A function pointer to a destructor function. </p> <dl class="section see"><dt>See also</dt><dd>ucx_mempool_setdestr() </dd> <dd> ucx_mempool_regdestr() </dd></dl> </div> </div> <a id="a989b3f0fa4d307d278378fde435641ed"></a> <h2 class="memtitle"><span class="permalink"><a href="#a989b3f0fa4d307d278378fde435641ed">◆ </a></span>write_func</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef size_t(* write_func) (const void *, size_t, size_t, void *)</td> </tr> </table> </div><div class="memdoc"> <p>Function pointer to a write function. </p> <p>The signature of the write function shall be compatible to the signature of standard <code>fwrite</code>, though it may use arbitrary data types for source and destination.</p> <p>The arguments shall contain (in ascending order): a pointer to the source, the length of one element, the element count and a pointer to the destination. </p> </div> </div> <h2 class="groupheader">Function Documentation</h2> <a id="a6637171cc0ec097b297f731a3036dd3b"></a> <h2 class="memtitle"><span class="permalink"><a href="#a6637171cc0ec097b297f731a3036dd3b">◆ </a></span>ucx_szmul_impl()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int ucx_szmul_impl </td> <td>(</td> <td class="paramtype">size_t </td> <td class="paramname"><em>a</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t * </td> <td class="paramname"><em>result</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Performs a multiplication of size_t values and checks for overflow. </p> <p>This is a custom implementation in case there is no compiler builtin available.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">a</td><td>first operand </td></tr> <tr><td class="paramname">b</td><td>second operand </td></tr> <tr><td class="paramname">result</td><td>a pointer to a size_t where the result should be stored </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>zero, if no overflow occurred and the result is correct, non-zero otherwise </dd></dl> </div> </div> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Thu Dec 19 2019 19:58:24 for ucx by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.13 </small></address> </body> </html>