選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

121 行
5.0KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <title>a64l (The Red Hat newlib C Library)</title>
  7. <meta name="description" content="a64l (The Red Hat newlib C Library)">
  8. <meta name="keywords" content="a64l (The Red Hat newlib C Library)">
  9. <meta name="resource-type" content="document">
  10. <meta name="distribution" content="global">
  11. <meta name="Generator" content="makeinfo">
  12. <link href="index.html#Top" rel="start" title="Top">
  13. <link href="Document-Index.html#Document-Index" rel="index" title="Document Index">
  14. <link href="Document-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
  15. <link href="Stdlib.html#Stdlib" rel="up" title="Stdlib">
  16. <link href="abort.html#abort" rel="next" title="abort">
  17. <link href="_005fExit.html#g_t_005fExit" rel="prev" title="_Exit">
  18. <style type="text/css">
  19. <!--
  20. a.summary-letter {text-decoration: none}
  21. blockquote.indentedblock {margin-right: 0em}
  22. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  23. blockquote.smallquotation {font-size: smaller}
  24. div.display {margin-left: 3.2em}
  25. div.example {margin-left: 3.2em}
  26. div.lisp {margin-left: 3.2em}
  27. div.smalldisplay {margin-left: 3.2em}
  28. div.smallexample {margin-left: 3.2em}
  29. div.smalllisp {margin-left: 3.2em}
  30. kbd {font-style: oblique}
  31. pre.display {font-family: inherit}
  32. pre.format {font-family: inherit}
  33. pre.menu-comment {font-family: serif}
  34. pre.menu-preformatted {font-family: serif}
  35. pre.smalldisplay {font-family: inherit; font-size: smaller}
  36. pre.smallexample {font-size: smaller}
  37. pre.smallformat {font-family: inherit; font-size: smaller}
  38. pre.smalllisp {font-size: smaller}
  39. span.nolinebreak {white-space: nowrap}
  40. span.roman {font-family: initial; font-weight: normal}
  41. span.sansserif {font-family: sans-serif; font-weight: normal}
  42. ul.no-bullet {list-style: none}
  43. -->
  44. </style>
  45. </head>
  46. <body lang="en">
  47. <a name="a64l"></a>
  48. <div class="header">
  49. <p>
  50. Next: <a href="abort.html#abort" accesskey="n" rel="next">abort</a>, Previous: <a href="_005fExit.html#g_t_005fExit" accesskey="p" rel="prev">_Exit</a>, Up: <a href="Stdlib.html#Stdlib" accesskey="u" rel="up">Stdlib</a> &nbsp; [<a href="Document-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Document-Index.html#Document-Index" title="Index" rel="index">Index</a>]</p>
  51. </div>
  52. <hr>
  53. <a name="a64l_002c-l64a_002d_002d_002dconvert-between-radix_002d64-ASCII-string-and-long"></a>
  54. <h3 class="section">2.2 <code>a64l</code>, <code>l64a</code>&mdash;convert between radix-64 ASCII string and long</h3>
  55. <a name="index-a64l"></a>
  56. <a name="index-l64a"></a>
  57. <p><strong>Synopsis</strong>
  58. </p><div class="example">
  59. <pre class="example">#include &lt;stdlib.h&gt;
  60. long a64l(const char *<var>input</var>);
  61. char *l64a(long <var>input</var>);
  62. </pre></div>
  63. <p><strong>Description</strong><br>
  64. Conversion is performed between long and radix-64 characters. The
  65. <code>l64a</code> routine transforms up to 32 bits of input value starting from
  66. least significant bits to the most significant bits. The input value
  67. is split up into a maximum of 5 groups of 6 bits and possibly one
  68. group of 2 bits (bits 31 and 30).
  69. </p>
  70. <p>Each group of 6 bits forms a value from 0&ndash;63 which is translated into
  71. a character as follows:
  72. </p>
  73. <ul>
  74. <li> 0 = &rsquo;.&rsquo;
  75. </li><li> 1 = &rsquo;/&rsquo;
  76. </li><li> 2&ndash;11 = &rsquo;0&rsquo; to &rsquo;9&rsquo;
  77. </li><li> 12&ndash;37 = &rsquo;A&rsquo; to &rsquo;Z&rsquo;
  78. </li><li> 38&ndash;63 = &rsquo;a&rsquo; to &rsquo;z&rsquo;
  79. </li></ul>
  80. <p>When the remaining bits are zero or all bits have been translated, a
  81. null terminator is appended to the string. An input value of 0
  82. results in the empty string.
  83. </p>
  84. <p>The <code>a64l</code> function performs the reverse translation. Each
  85. character is used to generate a 6-bit value for up to 30 bits and then
  86. a 2-bit value to complete a 32-bit result. The null terminator means
  87. that the remaining digits are 0. An empty input string or NULL string
  88. results in 0L. An invalid string results in undefined behavior. If
  89. the size of a long is greater than 32 bits, the result is sign-extended.
  90. </p>
  91. <br>
  92. <p><strong>Returns</strong><br>
  93. <code>l64a</code> returns a null-terminated string of 0 to 6 characters.
  94. <code>a64l</code> returns the 32-bit translated value from the input character string.
  95. </p>
  96. <br>
  97. <p><strong>Portability</strong><br>
  98. <code>l64a</code> and <code>a64l</code> are non-ANSI and are defined by the Single Unix Specification.
  99. </p>
  100. <p>Supporting OS subroutines required: None.
  101. </p>
  102. <br>
  103. <hr>
  104. <div class="header">
  105. <p>
  106. Next: <a href="abort.html#abort" accesskey="n" rel="next">abort</a>, Previous: <a href="_005fExit.html#g_t_005fExit" accesskey="p" rel="prev">_Exit</a>, Up: <a href="Stdlib.html#Stdlib" accesskey="u" rel="up">Stdlib</a> &nbsp; [<a href="Document-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Document-Index.html#Document-Index" title="Index" rel="index">Index</a>]</p>
  107. </div>
  108. </body>
  109. </html>