Jump to content

Bitwise operations: Difference between revisions

add RPL
m (→‎{{header|Perl}}: future-proof for 5.36, explicit :prototype)
(add RPL)
Line 5,360:
. "Bitwise rotation is not natively supported"
</syntaxhighlight>
=={{header|RPL}}==
≪ { AND OR XOR NOT SL SR ASR RL RR } → a b ops
≪ {} 1 ops SIZE '''FOR''' j
a →STR " " + '''IF''' j 3 ≤ '''THEN''' b →STR + " " + '''END'''
ops j GET →STR 2 OVER SIZE 1 - SUB + " -> " +
a j 3 ≤ b IFT ops j GET EVAL →STR + +
'''NEXT'''
≫ ≫ ‘'''BITOPS'''’ STO
{{out}}
<pre>
{ "# 355h # 113h AND -> # 111h"
"# 355h # 113h OR -> # 357h"
"# 355h # 113h XOR -> # 246h"
"# 355h NOT -> # FCAAh"
"# 355h SL -> # 6AAh"
"# 355h SR -> # 1AAh"
"# 355h ASR -> # 1AAh"
"# 355h RL -> # 6AAh"
"# 355h RR -> # 81AAh" }
</pre>
Operations made with a word size set at 16 bits.
 
=={{header|Ruby}}==
<syntaxhighlight lang="ruby">def bitwise(a, b)
Line 5,386 ⟶ 5,408:
a >> b : 1 0000000000000001
</pre>
 
=={{header|Rust}}==
<syntaxhighlight lang="rust">fn main() {
1,150

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.