root/doc_inner/doxygen/html/hash_8c_source.html

/* [<][>][^][v][top][bottom][index][help] */
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.14.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>YACASL2: src/hash.c Source File</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>
<script type="text/javascript" src="clipboard.js"></script>
<script type="text/javascript" src="cookie.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>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
  extensions: ["tex2jax.js"],
  jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="http://www.mathjax.org/mathjax/MathJax.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 id="projectrow">
  <td id="projectalign">
   <div id="projectname">YACASL2
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.14.0 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search/",'.html');
</script>
<script type="text/javascript">
$(function() { codefold.init(); });
</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',false);
  $(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">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li>  </ul>
</div>
</div><!-- top -->
<div id="doc-content">
<div class="header">
  <div class="headertitle"><div class="title">hash.c</div></div>
</div><!--header-->
<div class="contents">
<a href="hash_8c.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span><span class="preprocessor">#include &quot;<a class="code" href="hash_8h.html">hash.h</a>&quot;</span></div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno">    2</span> </div>
<div class="foldopen" id="foldopen00003" data-start="{" data-end="}">
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"><a class="line" href="hash_8h.html#ac7eca217f473c9ee585bc67d937e05a5">    3</a></span><span class="keywordtype">unsigned</span> <a class="code hl_function" href="hash_8c.html#ac7eca217f473c9ee585bc67d937e05a5">hash</a>(<span class="keywordtype">int</span> keyc, <a class="code hl_struct" href="struct_h_k_e_y.html">HKEY</a> *keyv[], <span class="keywordtype">int</span> tabsize)</div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno">    4</span>{</div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno">    5</span>    <span class="keywordtype">unsigned</span> hashval = 0;</div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno">    6</span>    <span class="keyword">enum</span> {</div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno">    7</span>        HASHNUM = 31</div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno">    8</span>    };</div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno">    9</span> </div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno">   10</span>    <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = 0; i &lt; keyc; i++) {</div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno">   11</span>        <span class="keywordflow">switch</span>(keyv[i]-&gt;type) {</div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno">   12</span>        <span class="keywordflow">case</span> <a class="code hl_enumvalue" href="hash_8h.html#a70448f6a2463cfd7382f14686c213f12a130818e45ff82e21df80cbe00b9eeb7a">CHARS</a>:</div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno">   13</span>            <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j = 0; keyv[i]-&gt;<a class="code hl_variable" href="struct_h_k_e_y.html#a64bcde13da9637c38f82b8e1e3cca46a">val</a>.<a class="code hl_variable" href="struct_h_k_e_y.html#a0ff8d86e9f42a33f515e9275520fede8">s</a>[j]; j++) {</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno">   14</span>                hashval = keyv[i]-&gt;<a class="code hl_variable" href="struct_h_k_e_y.html#a64bcde13da9637c38f82b8e1e3cca46a">val</a>.<a class="code hl_variable" href="struct_h_k_e_y.html#a0ff8d86e9f42a33f515e9275520fede8">s</a>[j] + HASHNUM * hashval;</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno">   15</span>            }</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno">   16</span>            <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno">   17</span>        <span class="keywordflow">case</span> <a class="code hl_enumvalue" href="hash_8h.html#a70448f6a2463cfd7382f14686c213f12afd5a5f51ce25953f3db2c7e93eb7864a">INT</a>:</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno">   18</span>            hashval = keyv[i]-&gt;<a class="code hl_variable" href="struct_h_k_e_y.html#a64bcde13da9637c38f82b8e1e3cca46a">val</a>.<a class="code hl_variable" href="struct_h_k_e_y.html#a53954bebe7298af89951a65a01832324">i</a> + HASHNUM * hashval;</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno">   19</span>            <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno">   20</span>        <span class="keywordflow">default</span>:</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno">   21</span>            <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno">   22</span>        }</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno">   23</span>    }</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno">   24</span>    <span class="keywordflow">return</span> (hashval % tabsize);</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno">   25</span>}</div>
</div>
<div class="ttc" id="ahash_8c_html_ac7eca217f473c9ee585bc67d937e05a5"><div class="ttname"><a href="hash_8c.html#ac7eca217f473c9ee585bc67d937e05a5">hash</a></div><div class="ttdeci">unsigned hash(int keyc, HKEY *keyv[], int tabsize)</div><div class="ttdoc">ハッシュ値を取得する</div><div class="ttdef"><b>Definition</b> <a href="#l00003">hash.c:3</a></div></div>
<div class="ttc" id="ahash_8h_html"><div class="ttname"><a href="hash_8h.html">hash.h</a></div></div>
<div class="ttc" id="ahash_8h_html_a70448f6a2463cfd7382f14686c213f12a130818e45ff82e21df80cbe00b9eeb7a"><div class="ttname"><a href="hash_8h.html#a70448f6a2463cfd7382f14686c213f12a130818e45ff82e21df80cbe00b9eeb7a">CHARS</a></div><div class="ttdeci">@ CHARS</div><div class="ttdef"><b>Definition</b> <a href="hash_8h_source.html#l00008">hash.h:8</a></div></div>
<div class="ttc" id="ahash_8h_html_a70448f6a2463cfd7382f14686c213f12afd5a5f51ce25953f3db2c7e93eb7864a"><div class="ttname"><a href="hash_8h.html#a70448f6a2463cfd7382f14686c213f12afd5a5f51ce25953f3db2c7e93eb7864a">INT</a></div><div class="ttdeci">@ INT</div><div class="ttdef"><b>Definition</b> <a href="hash_8h_source.html#l00009">hash.h:9</a></div></div>
<div class="ttc" id="astruct_h_k_e_y_html"><div class="ttname"><a href="struct_h_k_e_y.html">HKEY</a></div><div class="ttdoc">ハッシュ共用体のデータ型</div><div class="ttdef"><b>Definition</b> <a href="hash_8h_source.html#l00015">hash.h:15</a></div></div>
<div class="ttc" id="astruct_h_k_e_y_html_a0ff8d86e9f42a33f515e9275520fede8"><div class="ttname"><a href="struct_h_k_e_y.html#a0ff8d86e9f42a33f515e9275520fede8">HKEY::s</a></div><div class="ttdeci">char * s</div><div class="ttdef"><b>Definition</b> <a href="hash_8h_source.html#l00018">hash.h:18</a></div></div>
<div class="ttc" id="astruct_h_k_e_y_html_a53954bebe7298af89951a65a01832324"><div class="ttname"><a href="struct_h_k_e_y.html#a53954bebe7298af89951a65a01832324">HKEY::i</a></div><div class="ttdeci">int i</div><div class="ttdef"><b>Definition</b> <a href="hash_8h_source.html#l00019">hash.h:19</a></div></div>
<div class="ttc" id="astruct_h_k_e_y_html_a64bcde13da9637c38f82b8e1e3cca46a"><div class="ttname"><a href="struct_h_k_e_y.html#a64bcde13da9637c38f82b8e1e3cca46a">HKEY::val</a></div><div class="ttdeci">union HKEY::@132303155052201023056030363273137132157157107260 val</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on <span class="timestamp"></span> for YACASL2 by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.14.0
</small></address>
</div><!-- doc-content -->
</body>
</html>

/* [<][>][^][v][top][bottom][index][help] */