<!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>
<title>doc_inner/gnu_global/S/20683.html</title>
<meta name='robots' content='noindex,nofollow' />
<meta name='generator' content='GLOBAL-6.6.14' />
<meta http-equiv='Content-Style-Type' content='text/css' />
<link rel='stylesheet' type='text/css' href='../style.css' />
</head>
<body>
<a id='TOP' name='TOP'></a><h2 class='header'><a href='../mains.html'>root</a>/<a href='../files/30282.html'>doc_inner</a>/<a href='../files/30285.html'>gnu_global</a>/<a href='../files/30290.html'>S</a>/20683.html</h2>
<em class='comment'>/* [<][>][^][v][top]<a href='#BOTTOM'>[bottom]</a><a href='../mains.html'>[index]</a><a href='../help.html'>[help]</a> */</em>
<hr />
<pre>
<a id='L1' name='L1'></a><!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<a id='L2' name='L2'></a><html xmlns='http://www.w3.org/1999/xhtml'>
<a id='L3' name='L3'></a><head>
<a id='L4' name='L4'></a><title>test/unit/hash/cmd.c</title>
<a id='L5' name='L5'></a><meta name='robots' content='noindex,nofollow' />
<a id='L6' name='L6'></a><meta name='generator' content='GLOBAL-6.6.14' />
<a id='L7' name='L7'></a><meta http-equiv='Content-Style-Type' content='text/css' />
<a id='L8' name='L8'></a><link rel='stylesheet' type='text/css' href='../style.css' />
<a id='L9' name='L9'></a></head>
<a id='L10' name='L10'></a><body>
<a id='L11' name='L11'></a><a id='TOP' name='TOP'></a><h2 class='header'><a href='../mains.html'>root</a>/<a href='../files/24435.html'>test</a>/<a href='../files/24942.html'>unit</a>/<a href='../files/24947.html'>hash</a>/cmd.c</h2>
<a id='L12' name='L12'></a><em class='comment'>/* [&lt;][&gt;]<a href='#L6'>[^]</a><a href='#L58'>[v]</a>[top]<a href='#BOTTOM'>[bottom]</a><a href='../mains.html'>[index]</a><a href='../help.html'>[help]</a> */</em>
<a id='L13' name='L13'></a><hr />
<a id='L14' name='L14'></a><h2 class='header'>DEFINITIONS</h2>
<a id='L15' name='L15'></a>This source file includes following definitions.
<a id='L16' name='L16'></a><ol>
<a id='L17' name='L17'></a><li><a href='#L6' title='Defined at 6.'>hash_char2</a></li>
<a id='L18' name='L18'></a><li><a href='#L22' title='Defined at 22.'>hash_int2</a></li>
<a id='L19' name='L19'></a><li><a href='#L37' title='Defined at 37.'>hash_char2_int2</a></li>
<a id='L20' name='L20'></a><li><a href='#L58' title='Defined at 58.'>main</a></li>
<a id='L21' name='L21'></a></ol>
<a id='L22' name='L22'></a><hr />
<a id='L23' name='L23'></a><pre>
<a id='L24' name='L24'></a><a id='L1' name='L1'></a> 1 <em class='sharp'>#include</em> &lt;stdio.h&gt;
<a id='L25' name='L25'></a><a id='L2' name='L2'></a> 2 <em class='sharp'>#include</em> "<a href='23892.html'>hash.h</a>"
<a id='L26' name='L26'></a><a id='L3' name='L3'></a> 3 <em class='sharp'>#include</em> &lt;string.h&gt;
<a id='L27' name='L27'></a><a id='L4' name='L4'></a> 4 <em class='sharp'>#include</em> &lt;stdlib.h&gt;
<a id='L28' name='L28'></a><a id='L5' name='L5'></a> 5
<a id='L29' name='L29'></a><a id='L6' name='L6'></a> 6 <strong class='reserved'>unsigned</strong> <a href='../S/20683.html#L62' title='Referred from 62 in test/unit/hash/cmd.c.'>hash_char2</a>(<strong class='reserved'>int</strong> <a href='../Y/238.html' title='Multiple used in 10 places.'>tsize</a>)
<a id='L30' name='L30'></a><a id='L7' name='L7'></a> 7 <em class='brace'>{</em>
<a id='L31' name='L31'></a><a id='L8' name='L8'></a> 8 <strong class='reserved'>char</strong> *<a href='../Y/211.html' title='Multiple used in 118 places.'>str</a>[2] = <em class='brace'>{</em>"abc", "123"<em class='brace'>}</em>;
<a id='L32' name='L32'></a><a id='L9' name='L9'></a> 9 <strong class='reserved'>int</strong> <a href='../Y/118.html' title='Multiple used in 213 places.'>i</a>;
<a id='L33' name='L33'></a><a id='L10' name='L10'></a> 10 <a href='../S/23892.html#L21' title='Defined at 21 in include/hash.h.'>HKEY</a> *<a href='../Y/125.html' title='Multiple used in 41 places.'>keys</a>[2];
<a id='L34' name='L34'></a><a id='L11' name='L11'></a> 11
<a id='L35' name='L35'></a><a id='L12' name='L12'></a> 12 <em class='comment'>/* ハッシュ共用体の設定 */</em>
<a id='L36' name='L36'></a><a id='L13' name='L13'></a> 13 <strong class='reserved'>for</strong>(<a href='../Y/118.html' title='Multiple used in 213 places.'>i</a> = 0; <a href='../Y/118.html' title='Multiple used in 213 places.'>i</a> &lt; 2; <a href='../Y/118.html' title='Multiple used in 213 places.'>i</a>++) <em class='brace'>{</em>
<a id='L37' name='L37'></a><a id='L14' name='L14'></a> 14 <a href='../Y/125.html' title='Multiple used in 41 places.'>keys</a>[<a href='../Y/118.html' title='Multiple used in 213 places.'>i</a>] = <a href='../Y/144.html' title='Multiple used in 7 places.'>malloc</a>(<strong class='reserved'>sizeof</strong>(<a href='../S/23892.html#L21' title='Defined at 21 in include/hash.h.'>HKEY</a>));
<a id='L38' name='L38'></a><a id='L15' name='L15'></a> 15 <a href='../Y/125.html' title='Multiple used in 41 places.'>keys</a>[<a href='../Y/118.html' title='Multiple used in 213 places.'>i</a>]-&gt;<a href='../Y/239.html' title='Multiple used in 30 places.'>type</a> = <a href='../S/23892.html#L8' title='Defined at 8 in include/hash.h.'>CHARS</a>;
<a id='L39' name='L39'></a><a id='L16' name='L16'></a> 16 <a href='../Y/125.html' title='Multiple used in 41 places.'>keys</a>[<a href='../Y/118.html' title='Multiple used in 213 places.'>i</a>]-&gt;<a href='../Y/241.html' title='Multiple used in 35 places.'>val</a>.<a href='../Y/194.html' title='Multiple used in 74 places.'>s</a> = <a href='../Y/218.html' title='Multiple used in 2 places.'>strdup</a>(<a href='../Y/211.html' title='Multiple used in 118 places.'>str</a>[<a href='../Y/118.html' title='Multiple used in 213 places.'>i</a>]);
<a id='L40' name='L40'></a><a id='L17' name='L17'></a> 17 <em class='brace'>}</em>
<a id='L41' name='L41'></a><a id='L18' name='L18'></a> 18 <em class='comment'>/* ハッシュ値を取得する */</em>
<a id='L42' name='L42'></a><a id='L19' name='L19'></a> 19 <strong class='reserved'>return</strong> <a href='../S/24332.html#L3' title='Defined at 3 in src/hash.c.'>hash</a>(2, <a href='../Y/125.html' title='Multiple used in 41 places.'>keys</a>, <a href='../Y/238.html' title='Multiple used in 10 places.'>tsize</a>);
<a id='L43' name='L43'></a><a id='L20' name='L20'></a> 20 <em class='brace'>}</em>
<a id='L44' name='L44'></a><a id='L21' name='L21'></a> 21
<a id='L45' name='L45'></a><a id='L22' name='L22'></a> 22 <strong class='reserved'>unsigned</strong> <a href='../S/20683.html#L63' title='Referred from 63 in test/unit/hash/cmd.c.'>hash_int2</a>(<strong class='reserved'>int</strong> <a href='../Y/238.html' title='Multiple used in 10 places.'>tsize</a>)
<a id='L46' name='L46'></a><a id='L23' name='L23'></a> 23 <em class='brace'>{</em>
<a id='L47' name='L47'></a><a id='L24' name='L24'></a> 24 <strong class='reserved'>int</strong> <a href='../Y/161.html' title='Multiple used in 57 places.'>num</a>[2] = <em class='brace'>{</em>19, 11<em class='brace'>}</em>, <a href='../Y/118.html' title='Multiple used in 213 places.'>i</a>;
<a id='L48' name='L48'></a><a id='L25' name='L25'></a> 25 <a href='../S/23892.html#L21' title='Defined at 21 in include/hash.h.'>HKEY</a> *<a href='../Y/125.html' title='Multiple used in 41 places.'>keys</a>[2];
<a id='L49' name='L49'></a><a id='L26' name='L26'></a> 26
<a id='L50' name='L50'></a><a id='L27' name='L27'></a> 27 <em class='comment'>/* ハッシュ共用体の設定 */</em>
<a id='L51' name='L51'></a><a id='L28' name='L28'></a> 28 <strong class='reserved'>for</strong>(<a href='../Y/118.html' title='Multiple used in 213 places.'>i</a> = 0; <a href='../Y/118.html' title='Multiple used in 213 places.'>i</a> &lt; 2; <a href='../Y/118.html' title='Multiple used in 213 places.'>i</a>++) <em class='brace'>{</em>
<a id='L52' name='L52'></a><a id='L29' name='L29'></a> 29 <a href='../Y/125.html' title='Multiple used in 41 places.'>keys</a>[<a href='../Y/118.html' title='Multiple used in 213 places.'>i</a>] = <a href='../Y/144.html' title='Multiple used in 7 places.'>malloc</a>(<strong class='reserved'>sizeof</strong>(<a href='../S/23892.html#L21' title='Defined at 21 in include/hash.h.'>HKEY</a>));
<a id='L53' name='L53'></a><a id='L30' name='L30'></a> 30 <a href='../Y/125.html' title='Multiple used in 41 places.'>keys</a>[<a href='../Y/118.html' title='Multiple used in 213 places.'>i</a>]-&gt;<a href='../Y/239.html' title='Multiple used in 30 places.'>type</a> = <a href='../S/23892.html#L9' title='Defined at 9 in include/hash.h.'>INT</a>;
<a id='L54' name='L54'></a><a id='L31' name='L31'></a> 31 <a href='../Y/125.html' title='Multiple used in 41 places.'>keys</a>[<a href='../Y/118.html' title='Multiple used in 213 places.'>i</a>]-&gt;<a href='../Y/241.html' title='Multiple used in 35 places.'>val</a>.<a href='../Y/118.html' title='Multiple used in 213 places.'>i</a> = <a href='../Y/161.html' title='Multiple used in 57 places.'>num</a>[<a href='../Y/118.html' title='Multiple used in 213 places.'>i</a>];
<a id='L55' name='L55'></a><a id='L32' name='L32'></a> 32 <em class='brace'>}</em>
<a id='L56' name='L56'></a><a id='L33' name='L33'></a> 33 <em class='comment'>/* ハッシュ値を取得する */</em>
<a id='L57' name='L57'></a><a id='L34' name='L34'></a> 34 <strong class='reserved'>return</strong> <a href='../S/24332.html#L3' title='Defined at 3 in src/hash.c.'>hash</a>(2, <a href='../Y/125.html' title='Multiple used in 41 places.'>keys</a>, <a href='../Y/238.html' title='Multiple used in 10 places.'>tsize</a>);
<a id='L58' name='L58'></a><a id='L35' name='L35'></a> 35 <em class='brace'>}</em>
<a id='L59' name='L59'></a><a id='L36' name='L36'></a> 36
<a id='L60' name='L60'></a><a id='L37' name='L37'></a> 37 <strong class='reserved'>unsigned</strong> <a href='../S/20683.html#L64' title='Referred from 64 in test/unit/hash/cmd.c.'>hash_char2_int2</a>(<strong class='reserved'>int</strong> <a href='../Y/238.html' title='Multiple used in 10 places.'>tsize</a>)
<a id='L61' name='L61'></a><a id='L38' name='L38'></a> 38 <em class='brace'>{</em>
<a id='L62' name='L62'></a><a id='L39' name='L39'></a> 39 <strong class='reserved'>char</strong> *<a href='../Y/211.html' title='Multiple used in 118 places.'>str</a>[2] = <em class='brace'>{</em>"abc", "123"<em class='brace'>}</em>;
<a id='L63' name='L63'></a><a id='L40' name='L40'></a> 40 <strong class='reserved'>int</strong> <a href='../Y/161.html' title='Multiple used in 57 places.'>num</a>[2] = <em class='brace'>{</em>19, 11<em class='brace'>}</em>, <a href='../Y/118.html' title='Multiple used in 213 places.'>i</a>, <a href='../Y/68.html' title='Multiple used in 30 places.'>cnt</a> = 0;
<a id='L64' name='L64'></a><a id='L41' name='L41'></a> 41 <a href='../S/23892.html#L21' title='Defined at 21 in include/hash.h.'>HKEY</a> *<a href='../Y/125.html' title='Multiple used in 41 places.'>keys</a>[4];
<a id='L65' name='L65'></a><a id='L42' name='L42'></a> 42
<a id='L66' name='L66'></a><a id='L43' name='L43'></a> 43 <em class='comment'>/* ハッシュ共用体の設定 */</em>
<a id='L67' name='L67'></a><a id='L44' name='L44'></a> 44 <strong class='reserved'>for</strong>(<a href='../Y/118.html' title='Multiple used in 213 places.'>i</a> = 0; <a href='../Y/118.html' title='Multiple used in 213 places.'>i</a> &lt; 2; <a href='../Y/118.html' title='Multiple used in 213 places.'>i</a>++) <em class='brace'>{</em>
<a id='L68' name='L68'></a><a id='L45' name='L45'></a> 45 <a href='../Y/125.html' title='Multiple used in 41 places.'>keys</a>[<a href='../Y/68.html' title='Multiple used in 30 places.'>cnt</a>] = <a href='../Y/144.html' title='Multiple used in 7 places.'>malloc</a>(<strong class='reserved'>sizeof</strong>(<a href='../S/23892.html#L21' title='Defined at 21 in include/hash.h.'>HKEY</a>));
<a id='L69' name='L69'></a><a id='L46' name='L46'></a> 46 <a href='../Y/125.html' title='Multiple used in 41 places.'>keys</a>[<a href='../Y/68.html' title='Multiple used in 30 places.'>cnt</a>]-&gt;<a href='../Y/239.html' title='Multiple used in 30 places.'>type</a> = <a href='../S/23892.html#L8' title='Defined at 8 in include/hash.h.'>CHARS</a>;
<a id='L70' name='L70'></a><a id='L47' name='L47'></a> 47 <a href='../Y/125.html' title='Multiple used in 41 places.'>keys</a>[<a href='../Y/68.html' title='Multiple used in 30 places.'>cnt</a>++]-&gt;<a href='../Y/241.html' title='Multiple used in 35 places.'>val</a>.<a href='../Y/194.html' title='Multiple used in 74 places.'>s</a> = <a href='../Y/218.html' title='Multiple used in 2 places.'>strdup</a>(<a href='../Y/211.html' title='Multiple used in 118 places.'>str</a>[<a href='../Y/118.html' title='Multiple used in 213 places.'>i</a>]);
<a id='L71' name='L71'></a><a id='L48' name='L48'></a> 48 <em class='brace'>}</em>
<a id='L72' name='L72'></a><a id='L49' name='L49'></a> 49 <strong class='reserved'>for</strong>(<a href='../Y/118.html' title='Multiple used in 213 places.'>i</a> = 0; <a href='../Y/118.html' title='Multiple used in 213 places.'>i</a> &lt; 2; <a href='../Y/118.html' title='Multiple used in 213 places.'>i</a>++) <em class='brace'>{</em>
<a id='L73' name='L73'></a><a id='L50' name='L50'></a> 50 <a href='../Y/125.html' title='Multiple used in 41 places.'>keys</a>[<a href='../Y/68.html' title='Multiple used in 30 places.'>cnt</a>] = <a href='../Y/144.html' title='Multiple used in 7 places.'>malloc</a>(<strong class='reserved'>sizeof</strong>(<a href='../S/23892.html#L21' title='Defined at 21 in include/hash.h.'>HKEY</a>));
<a id='L74' name='L74'></a><a id='L51' name='L51'></a> 51 <a href='../Y/125.html' title='Multiple used in 41 places.'>keys</a>[<a href='../Y/68.html' title='Multiple used in 30 places.'>cnt</a>]-&gt;<a href='../Y/239.html' title='Multiple used in 30 places.'>type</a> = <a href='../S/23892.html#L9' title='Defined at 9 in include/hash.h.'>INT</a>;
<a id='L75' name='L75'></a><a id='L52' name='L52'></a> 52 <a href='../Y/125.html' title='Multiple used in 41 places.'>keys</a>[<a href='../Y/68.html' title='Multiple used in 30 places.'>cnt</a>++]-&gt;<a href='../Y/241.html' title='Multiple used in 35 places.'>val</a>.<a href='../Y/118.html' title='Multiple used in 213 places.'>i</a> = <a href='../Y/161.html' title='Multiple used in 57 places.'>num</a>[<a href='../Y/118.html' title='Multiple used in 213 places.'>i</a>];
<a id='L76' name='L76'></a><a id='L53' name='L53'></a> 53 <em class='brace'>}</em>
<a id='L77' name='L77'></a><a id='L54' name='L54'></a> 54 <em class='comment'>/* ハッシュ値を取得する */</em>
<a id='L78' name='L78'></a><a id='L55' name='L55'></a> 55 <strong class='reserved'>return</strong> <a href='../S/24332.html#L3' title='Defined at 3 in src/hash.c.'>hash</a>(4, <a href='../Y/125.html' title='Multiple used in 41 places.'>keys</a>, <a href='../Y/238.html' title='Multiple used in 10 places.'>tsize</a>);
<a id='L79' name='L79'></a><a id='L56' name='L56'></a> 56 <em class='brace'>}</em>
<a id='L80' name='L80'></a><a id='L57' name='L57'></a> 57
<a id='L81' name='L81'></a><a id='L58' name='L58'></a> 58 <strong class='reserved'>int</strong> main()
<a id='L82' name='L82'></a><a id='L59' name='L59'></a> 59 <em class='brace'>{</em>
<a id='L83' name='L83'></a><a id='L60' name='L60'></a> 60 <strong class='reserved'>int</strong> <a href='../Y/238.html' title='Multiple used in 10 places.'>tsize</a> = 31;
<a id='L84' name='L84'></a><a id='L61' name='L61'></a> 61
<a id='L85' name='L85'></a><a id='L62' name='L62'></a> 62 <a href='../Y/180.html' title='Multiple used in 32 places.'>printf</a>("HASH VALUE: %d\n", <a href='../S/20683.html#L6' title='Defined at 6 in test/unit/hash/cmd.c.'>hash_char2</a>(<a href='../Y/238.html' title='Multiple used in 10 places.'>tsize</a>));
<a id='L86' name='L86'></a><a id='L63' name='L63'></a> 63 <a href='../Y/180.html' title='Multiple used in 32 places.'>printf</a>("HASH VALUE: %d\n", <a href='../S/20683.html#L22' title='Defined at 22 in test/unit/hash/cmd.c.'>hash_int2</a>(<a href='../Y/238.html' title='Multiple used in 10 places.'>tsize</a>));
<a id='L87' name='L87'></a><a id='L64' name='L64'></a> 64 <a href='../Y/180.html' title='Multiple used in 32 places.'>printf</a>("HASH VALUE: %d\n", <a href='../S/20683.html#L37' title='Defined at 37 in test/unit/hash/cmd.c.'>hash_char2_int2</a>(<a href='../Y/238.html' title='Multiple used in 10 places.'>tsize</a>));
<a id='L88' name='L88'></a><a id='L65' name='L65'></a> 65 <strong class='reserved'>return</strong> 0;
<a id='L89' name='L89'></a><a id='L66' name='L66'></a> 66 <em class='brace'>}</em>
<a id='L90' name='L90'></a></pre>
<a id='L91' name='L91'></a><hr />
<a id='L92' name='L92'></a><a id='BOTTOM' name='BOTTOM'></a>
<a id='L93' name='L93'></a><em class='comment'>/* [&lt;][&gt;]<a href='#L6'>[^]</a><a href='#L58'>[v]</a><a href='#TOP'>[top]</a>[bottom]<a href='../mains.html'>[index]</a><a href='../help.html'>[help]</a> */</em>
<a id='L94' name='L94'></a></body>
<a id='L95' name='L95'></a></html>
</pre>
<hr />
<a id='BOTTOM' name='BOTTOM'></a>
<em class='comment'>/* [<][>][^][v]<a href='#TOP'>[top]</a>[bottom]<a href='../mains.html'>[index]</a><a href='../help.html'>[help]</a> */</em>
</body>
</html>