Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / html / python / ref / bitwise.html
CommitLineData
920dae64
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="ref.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="ref.html" title='Python Reference Manual' />
8<link rel='contents' href='contents.html' title="Contents" />
9<link rel='index' href='genindex.html' title='Index' />
10<link rel='last' href='about.html' title='About this document...' />
11<link rel='help' href='about.html' title='About this document...' />
12<link rel="next" href="comparisons.html" />
13<link rel="prev" href="shifting.html" />
14<link rel="parent" href="expressions.html" />
15<link rel="next" href="comparisons.html" />
16<meta name='aesop' content='information' />
17<title>5.8 Binary bit-wise operations</title>
18</head>
19<body>
20<DIV CLASS="navigation">
21<div id='top-navigation-panel' xml:id='top-navigation-panel'>
22<table align="center" width="100%" cellpadding="0" cellspacing="2">
23<tr>
24<td class='online-navigation'><a rel="prev" title="5.7 Shifting operations"
25 href="shifting.html"><img src='../icons/previous.png'
26 border='0' height='32' alt='Previous Page' width='32' /></A></td>
27<td class='online-navigation'><a rel="parent" title="5. Expressions"
28 href="expressions.html"><img src='../icons/up.png'
29 border='0' height='32' alt='Up One Level' width='32' /></A></td>
30<td class='online-navigation'><a rel="next" title="5.9 Comparisons"
31 href="comparisons.html"><img src='../icons/next.png'
32 border='0' height='32' alt='Next Page' width='32' /></A></td>
33<td align="center" width="100%">Python Reference Manual</td>
34<td class='online-navigation'><a rel="contents" title="Table of Contents"
35 href="contents.html"><img src='../icons/contents.png'
36 border='0' height='32' alt='Contents' width='32' /></A></td>
37<td class='online-navigation'><img src='../icons/blank.png'
38 border='0' height='32' alt='' width='32' /></td>
39<td class='online-navigation'><a rel="index" title="Index"
40 href="genindex.html"><img src='../icons/index.png'
41 border='0' height='32' alt='Index' width='32' /></A></td>
42</tr></table>
43<div class='online-navigation'>
44<b class="navlabel">Previous:</b>
45<a class="sectref" rel="prev" href="shifting.html">5.7 Shifting operations</A>
46<b class="navlabel">Up:</b>
47<a class="sectref" rel="parent" href="expressions.html">5. Expressions</A>
48<b class="navlabel">Next:</b>
49<a class="sectref" rel="next" href="comparisons.html">5.9 Comparisons</A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H1><A NAME="SECTION007800000000000000000"></A><A NAME="bitwise"></A>
56<BR>
575.8 Binary bit-wise operations
58</H1>
59<a id='l2h-423' xml:id='l2h-423'></a>
60<P>
61Each of the three bitwise operations has a different priority level:
62
63<P>
64<dl><dd class="grammar">
65<div class="productions">
66<table>
67<tr>
68 <td><a id='tok-and_expr' xml:id='tok-and_expr'>and_expr</a></td>
69 <td>::=</td>
70 <td><a class='grammartoken' href="shifting.html#tok-shift_expr">shift_expr</a> | <a class='grammartoken' href="bitwise.html#tok-and_expr">and_expr</a> &quot&amp;" <a class='grammartoken' href="shifting.html#tok-shift_expr">shift_expr</a></td></tr>
71 <tr>
72 <td><a id='tok-xor_expr' xml:id='tok-xor_expr'>xor_expr</a></td>
73 <td>::=</td>
74 <td><a class='grammartoken' href="bitwise.html#tok-and_expr">and_expr</a> | <a class='grammartoken' href="bitwise.html#tok-xor_expr">xor_expr</a> "^" <a class='grammartoken' href="bitwise.html#tok-and_expr">and_expr</a></td></tr>
75 <tr>
76 <td><a id='tok-or_expr' xml:id='tok-or_expr'>or_expr</a></td>
77 <td>::=</td>
78 <td><a class='grammartoken' href="bitwise.html#tok-xor_expr">xor_expr</a> | <a class='grammartoken' href="bitwise.html#tok-or_expr">or_expr</a> "|" <a class='grammartoken' href="bitwise.html#tok-xor_expr">xor_expr</a></td></tr>
79</table>
80</div>
81<a class="grammar-footer"
82 href="grammar.txt" type="text/plain"
83 >Download entire grammar as text.</a>
84</dd></dl>
85
86<P>
87The <code>&amp;</code> operator yields the bitwise AND of its arguments, which
88must be plain or long integers. The arguments are converted to a
89common type.
90<a id='l2h-424' xml:id='l2h-424'></a>
91<P>
92The <code>^</code> operator yields the bitwise XOR (exclusive OR) of its
93arguments, which must be plain or long integers. The arguments are
94converted to a common type.
95<a id='l2h-425' xml:id='l2h-425'></a><a id='l2h-426' xml:id='l2h-426'></a>
96<P>
97The <code>|</code> operator yields the bitwise (inclusive) OR of its
98arguments, which must be plain or long integers. The arguments are
99converted to a common type.
100<a id='l2h-427' xml:id='l2h-427'></a><a id='l2h-428' xml:id='l2h-428'></a>
101<P>
102
103<DIV CLASS="navigation">
104<div class='online-navigation'>
105<p></p><hr />
106<table align="center" width="100%" cellpadding="0" cellspacing="2">
107<tr>
108<td class='online-navigation'><a rel="prev" title="5.7 Shifting operations"
109 href="shifting.html"><img src='../icons/previous.png'
110 border='0' height='32' alt='Previous Page' width='32' /></A></td>
111<td class='online-navigation'><a rel="parent" title="5. Expressions"
112 href="expressions.html"><img src='../icons/up.png'
113 border='0' height='32' alt='Up One Level' width='32' /></A></td>
114<td class='online-navigation'><a rel="next" title="5.9 Comparisons"
115 href="comparisons.html"><img src='../icons/next.png'
116 border='0' height='32' alt='Next Page' width='32' /></A></td>
117<td align="center" width="100%">Python Reference Manual</td>
118<td class='online-navigation'><a rel="contents" title="Table of Contents"
119 href="contents.html"><img src='../icons/contents.png'
120 border='0' height='32' alt='Contents' width='32' /></A></td>
121<td class='online-navigation'><img src='../icons/blank.png'
122 border='0' height='32' alt='' width='32' /></td>
123<td class='online-navigation'><a rel="index" title="Index"
124 href="genindex.html"><img src='../icons/index.png'
125 border='0' height='32' alt='Index' width='32' /></A></td>
126</tr></table>
127<div class='online-navigation'>
128<b class="navlabel">Previous:</b>
129<a class="sectref" rel="prev" href="shifting.html">5.7 Shifting operations</A>
130<b class="navlabel">Up:</b>
131<a class="sectref" rel="parent" href="expressions.html">5. Expressions</A>
132<b class="navlabel">Next:</b>
133<a class="sectref" rel="next" href="comparisons.html">5.9 Comparisons</A>
134</div>
135</div>
136<hr />
137<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
138</DIV>
139<!--End of Navigation Panel-->
140<ADDRESS>
141See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
142</ADDRESS>
143</BODY>
144</HTML>