Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
8
Task/Bitwise-operations/Tcl/bitwise-operations-1.tcl
Normal file
8
Task/Bitwise-operations/Tcl/bitwise-operations-1.tcl
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
proc bitwise {a b} {
|
||||
puts [format "a and b: %#08x" [expr {$a & $b}]]
|
||||
puts [format "a or b: %#08x" [expr {$a | $b}]]
|
||||
puts [format "a xor b: %#08x" [expr {$a ^ $b}]]
|
||||
puts [format "not a: %#08x" [expr {~$a}]]
|
||||
puts [format "a << b: %#08x" [expr {$a << $b}]]
|
||||
puts [format "a >> b: %#08x" [expr {$a >> $b}]]
|
||||
}
|
||||
13
Task/Bitwise-operations/Tcl/bitwise-operations-2.tcl
Normal file
13
Task/Bitwise-operations/Tcl/bitwise-operations-2.tcl
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
proc bitwiseUnsupported {a b} {
|
||||
set bits 0xFFFFFFFF
|
||||
# Force interpretation as a 32-bit unsigned value
|
||||
puts [format "a ArithRightShift b: %#08x" [expr {($a & $bits) >> $b}]]
|
||||
puts [format "a RotateRight b: %#08x" [expr {
|
||||
(($a >> $b) & ($bits >> $b)) |
|
||||
(($a << (32-$b)) & ($bits ^ ($bits >> $b)))
|
||||
}]]
|
||||
puts [format "a RotateLeft b: %#08x" [expr {
|
||||
(($a << $b) & $bits & ($bits << $b)) |
|
||||
(($a >> (32-$b)) & ($bits ^ ($bits << $b)))
|
||||
}]]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue