Bitwise operations: Difference between revisions
Content added Content deleted
m (→{{header|D}}: remove incorrect; added shifts (not tested, hard time compiling gdc)) |
No edit summary |
||
Line 726: | Line 726: | ||
print ("a asr b: " ^ Word.fmt StringCvt.DEC (Word.>> (a, b) ) ^ "\n") (* logical right shift *) |
print ("a asr b: " ^ Word.fmt StringCvt.DEC (Word.>> (a, b) ) ^ "\n") (* logical right shift *) |
||
)</lang> |
)</lang> |
||
=={{header|Tcl}}== |
|||
<lang tcl>proc bitwise {a b} { |
|||
puts [format "a and b: %d" [expr {$a & $b}]] |
|||
puts [format "a or b: %d" [expr {$a | $b}]] |
|||
puts [format "a xor b: %d" [expr {$a ^ $b}]] |
|||
puts [format "not a: %d" [expr {~$a}]] |
|||
puts [format "a << b: %d" [expr {$a << $b}]] |
|||
puts [format "a >> b: %d" [expr {$a >> $b}]] |
|||
}</lang> |
|||
=={{header|Visual Basic .NET}}== |
=={{header|Visual Basic .NET}}== |