Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

209 lines
6.9KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- This file documents the GNU Assembler "as".
  4. Copyright (C) 1991-2020 Free Software Foundation, Inc.
  5. Permission is granted to copy, distribute and/or modify this document
  6. under the terms of the GNU Free Documentation License, Version 1.3
  7. or any later version published by the Free Software Foundation;
  8. with no Invariant Sections, with no Front-Cover Texts, and with no
  9. Back-Cover Texts. A copy of the license is included in the
  10. section entitled "GNU Free Documentation License".
  11. -->
  12. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  15. <title>Infix Ops (Using as)</title>
  16. <meta name="description" content="Infix Ops (Using as)">
  17. <meta name="keywords" content="Infix Ops (Using as)">
  18. <meta name="resource-type" content="document">
  19. <meta name="distribution" content="global">
  20. <meta name="Generator" content="makeinfo">
  21. <link href="index.html#Top" rel="start" title="Top">
  22. <link href="AS-Index.html#AS-Index" rel="index" title="AS Index">
  23. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  24. <link href="Integer-Exprs.html#Integer-Exprs" rel="up" title="Integer Exprs">
  25. <link href="Pseudo-Ops.html#Pseudo-Ops" rel="next" title="Pseudo Ops">
  26. <link href="Prefix-Ops.html#Prefix-Ops" rel="prev" title="Prefix Ops">
  27. <style type="text/css">
  28. <!--
  29. a.summary-letter {text-decoration: none}
  30. blockquote.indentedblock {margin-right: 0em}
  31. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  32. blockquote.smallquotation {font-size: smaller}
  33. div.display {margin-left: 3.2em}
  34. div.example {margin-left: 3.2em}
  35. div.lisp {margin-left: 3.2em}
  36. div.smalldisplay {margin-left: 3.2em}
  37. div.smallexample {margin-left: 3.2em}
  38. div.smalllisp {margin-left: 3.2em}
  39. kbd {font-style: oblique}
  40. pre.display {font-family: inherit}
  41. pre.format {font-family: inherit}
  42. pre.menu-comment {font-family: serif}
  43. pre.menu-preformatted {font-family: serif}
  44. pre.smalldisplay {font-family: inherit; font-size: smaller}
  45. pre.smallexample {font-size: smaller}
  46. pre.smallformat {font-family: inherit; font-size: smaller}
  47. pre.smalllisp {font-size: smaller}
  48. span.nolinebreak {white-space: nowrap}
  49. span.roman {font-family: initial; font-weight: normal}
  50. span.sansserif {font-family: sans-serif; font-weight: normal}
  51. ul.no-bullet {list-style: none}
  52. -->
  53. </style>
  54. </head>
  55. <body lang="en">
  56. <a name="Infix-Ops"></a>
  57. <div class="header">
  58. <p>
  59. Previous: <a href="Prefix-Ops.html#Prefix-Ops" accesskey="p" rel="prev">Prefix Ops</a>, Up: <a href="Integer-Exprs.html#Integer-Exprs" accesskey="u" rel="up">Integer Exprs</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  60. </div>
  61. <hr>
  62. <a name="Infix-Operators"></a>
  63. <h4 class="subsection">6.2.4 Infix Operators</h4>
  64. <a name="index-infix-operators"></a>
  65. <a name="index-operators_002c-permitted-arguments"></a>
  66. <p><em>Infix operators</em> take two arguments, one on either side. Operators
  67. have precedence, but operations with equal precedence are performed left
  68. to right. Apart from <code>+</code> or <samp>-</samp>, both arguments must be
  69. absolute, and the result is absolute.
  70. </p>
  71. <ol>
  72. <li><a name="index-operator-precedence"></a>
  73. <a name="index-precedence-of-operators"></a>
  74. </li><li> Highest Precedence
  75. <dl compact="compact">
  76. <dt><code>*</code></dt>
  77. <dd><p><em>Multiplication</em>.
  78. </p>
  79. </dd>
  80. <dt><code>/</code></dt>
  81. <dd><p><em>Division</em>. Truncation is the same as the C operator &lsquo;<samp>/</samp>&rsquo;
  82. </p>
  83. </dd>
  84. <dt><code>%</code></dt>
  85. <dd><p><em>Remainder</em>.
  86. </p>
  87. </dd>
  88. <dt><code>&lt;&lt;</code></dt>
  89. <dd><p><em>Shift Left</em>. Same as the C operator &lsquo;<samp>&lt;&lt;</samp>&rsquo;.
  90. </p>
  91. </dd>
  92. <dt><code>&gt;&gt;</code></dt>
  93. <dd><p><em>Shift Right</em>. Same as the C operator &lsquo;<samp>&gt;&gt;</samp>&rsquo;.
  94. </p></dd>
  95. </dl>
  96. </li><li> Intermediate precedence
  97. <dl compact="compact">
  98. <dt><code>|</code></dt>
  99. <dd>
  100. <p><em>Bitwise Inclusive Or</em>.
  101. </p>
  102. </dd>
  103. <dt><code>&amp;</code></dt>
  104. <dd><p><em>Bitwise And</em>.
  105. </p>
  106. </dd>
  107. <dt><code>^</code></dt>
  108. <dd><p><em>Bitwise Exclusive Or</em>.
  109. </p>
  110. </dd>
  111. <dt><code>!</code></dt>
  112. <dd><p><em>Bitwise Or Not</em>.
  113. </p></dd>
  114. </dl>
  115. </li><li> Low Precedence
  116. <dl compact="compact">
  117. <dd><a name="index-addition_002c-permitted-arguments"></a>
  118. <a name="index-plus_002c-permitted-arguments"></a>
  119. <a name="index-arguments-for-addition"></a>
  120. </dd>
  121. <dt><code>+</code></dt>
  122. <dd><p><em>Addition</em>. If either argument is absolute, the result has the section of
  123. the other argument. You may not add together arguments from different
  124. sections.
  125. </p>
  126. <a name="index-subtraction_002c-permitted-arguments"></a>
  127. <a name="index-minus_002c-permitted-arguments"></a>
  128. <a name="index-arguments-for-subtraction"></a>
  129. </dd>
  130. <dt><code>-</code></dt>
  131. <dd><p><em>Subtraction</em>. If the right argument is absolute, the
  132. result has the section of the left argument.
  133. If both arguments are in the same section, the result is absolute.
  134. You may not subtract arguments from different sections.
  135. </p>
  136. <a name="index-comparison-expressions"></a>
  137. <a name="index-expressions_002c-comparison"></a>
  138. </dd>
  139. <dt><code>==</code></dt>
  140. <dd><p><em>Is Equal To</em>
  141. </p></dd>
  142. <dt><code>&lt;&gt;</code></dt>
  143. <dt><code>!=</code></dt>
  144. <dd><p><em>Is Not Equal To</em>
  145. </p></dd>
  146. <dt><code>&lt;</code></dt>
  147. <dd><p><em>Is Less Than</em>
  148. </p></dd>
  149. <dt><code>&gt;</code></dt>
  150. <dd><p><em>Is Greater Than</em>
  151. </p></dd>
  152. <dt><code>&gt;=</code></dt>
  153. <dd><p><em>Is Greater Than Or Equal To</em>
  154. </p></dd>
  155. <dt><code>&lt;=</code></dt>
  156. <dd><p><em>Is Less Than Or Equal To</em>
  157. </p>
  158. <p>The comparison operators can be used as infix operators. A true results has a
  159. value of -1 whereas a false result has a value of 0. Note, these operators
  160. perform signed comparisons.
  161. </p></dd>
  162. </dl>
  163. </li><li> Lowest Precedence
  164. <dl compact="compact">
  165. <dt><code>&amp;&amp;</code></dt>
  166. <dd><p><em>Logical And</em>.
  167. </p>
  168. </dd>
  169. <dt><code>||</code></dt>
  170. <dd><p><em>Logical Or</em>.
  171. </p>
  172. <p>These two logical operations can be used to combine the results of sub
  173. expressions. Note, unlike the comparison operators a true result returns a
  174. value of 1 but a false results does still return 0. Also note that the logical
  175. or operator has a slightly lower precedence than logical and.
  176. </p>
  177. </dd>
  178. </dl>
  179. </li></ol>
  180. <p>In short, it&rsquo;s only meaningful to add or subtract the <em>offsets</em> in an
  181. address; you can only have a defined section in one of the two arguments.
  182. </p>
  183. <hr>
  184. <div class="header">
  185. <p>
  186. Previous: <a href="Prefix-Ops.html#Prefix-Ops" accesskey="p" rel="prev">Prefix Ops</a>, Up: <a href="Integer-Exprs.html#Integer-Exprs" accesskey="u" rel="up">Integer Exprs</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  187. </div>
  188. </body>
  189. </html>