Bitwise operations: Difference between revisions

Content added Content deleted
imported>Acediast
(→‎{{header|COBOL}}: Fixed to display properly.)
m (→‎{{header|Wren}}: Changed to Wren S/H)
Line 6,285: Line 6,285:


Given this limitation, there is no difference between logical and arithmetic left and right shift operations. Although Wren doesn't support circular shift operators, it is not difficult to write functions to perform them.
Given this limitation, there is no difference between logical and arithmetic left and right shift operations. Although Wren doesn't support circular shift operators, it is not difficult to write functions to perform them.
<syntaxhighlight lang="ecmascript">var rl = Fn.new { |x, y| x << y | x >> (32-y) }
<syntaxhighlight lang="wren">var rl = Fn.new { |x, y| x << y | x >> (32-y) }


var rr = Fn.new { |x, y| x >> y | x << (32-y) }
var rr = Fn.new { |x, y| x >> y | x << (32-y) }
Line 6,320: Line 6,320:
x rr y = 2147483650
x rr y = 2147483650
</pre>
</pre>

=={{header|x86 Assembly}}==
=={{header|x86 Assembly}}==
{{works with|nasm}}
{{works with|nasm}}