Bitwise operations: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 304:
result type x length 4.
 
write: `|a -> `{ &&a }, { hex_converter=>to_decimal( a ) }, { hex_converter=>to_binary( a &&) `}|, `/.
&& hex_converter=>to_decimal( a ) && `, `
&& hex_converter=>to_binary( a ).
new-line.
 
write: `|b -> `{ &&b }, { hex_converter=>to_decimal( b ) }, { hex_converter=>to_binary( b &&) `}|, `/.
&& hex_converter=>to_decimal( b ) && `, `
&& hex_converter=>to_binary( b ).
new-line.
 
writeresult `a and b -> ` && |{= a bit-and b }| && `, `.
write: |a && b -> { result }, { hex_converter=>to_decimal( aresult bit-and) b}, ){ &&hex_converter=>to_binary( result ) `}|, `/.
&& hex_converter=>to_binary( a bit-and b ).
new-line.
 
writeresult `a or b -> ` && |{= a bit-or b }| && `, `.
write: |a &&\| b -> { result }, { hex_converter=>to_decimal( aresult bit-or) b}, ){ &&hex_converter=>to_binary( result ) `}|, `/.
&& hex_converter=>to_binary( a bit-or b ).
new-line.
 
writeresult `a xor b -> ` && |{= a bit-xor b }| && `, `.
write: |a &&^ b -> { result }, { hex_converter=>to_decimal( aresult bit-xor) b}, ){ &&hex_converter=>to_binary( result ) `}|, `/.
&& hex_converter=>to_binary( a bit-xor b ).
new-line.
 
writeresult `complement a -> ` && |{= bit-not a }| && `, `.
write: |~a &&-> { result }, { hex_converter=>to_decimal( bit-not aresult ) &&}, { hex_converter=>to_binary( result ) `}|, `/.
&& hex_converter=>to_binary( bit-not a ).
new-line.
 
missing_bitwise_operations=>arithmetic_shift_left(
Line 340 ⟶ 326:
importing
e_value = result ).
write: `|a shift left<< b -> `{ &&result }, { hex_converter=>to_decimal( result ) }, { hex_converter=>to_binary( result &&) `}|, `/.
&& hex_converter=>to_decimal( result ) && `, `
&& hex_converter=>to_binary( result ).
new-line.
 
missing_bitwise_operations=>arithmetic_shift_right(
Line 351 ⟶ 334:
importing
e_value = result ).
write: `|a shift right>> b -> `{ &&result }, { hex_converter=>to_decimal( result ) }, { hex_converter=>to_binary( result &&) `}|, `/.
&& hex_converter=>to_decimal( result ) && `, `
&& hex_converter=>to_binary( result ).
new-line.
 
missing_bitwise_operations=>arithmetic_shift_left(
Line 362 ⟶ 342:
importing
e_value = result ).
write: |~a <<< b -> { result }, { hex_converter=>to_decimal( result ) }, { hex_converter=>to_binary( result ) }|, /.
write `(complement a) arithmetic shift left b -> ` && result && `, `
&& hex_converter=>to_decimal( result ) && `, `
&& hex_converter=>to_binary( result ).
new-line.
 
missing_bitwise_operations=>arithmetic_shift_right(
Line 373 ⟶ 350:
importing
e_value = result ).
write: |~a >>> b -> { result }, { hex_converter=>to_decimal( result ) }, { hex_converter=>to_binary( result ) }|, /.
write `(complement a) arithmetic shift right b -> ` && result && `, `
&& hex_converter=>to_decimal( result ) && `, `
&& hex_converter=>to_binary( result ).
new-line.
 
missing_bitwise_operations=>rotate_left(
Line 384 ⟶ 358:
importing
e_value = result ).
write: `(complement |~a) rotate leftrotl b -> `{ &&result }, { hex_converter=>to_decimal( result &&) }, { hex_converter=>to_binary( result ) `}|, `/.
&& hex_converter=>to_decimal( result ) && `, `
&& hex_converter=>to_binary( result ).
new-line.
 
missing_bitwise_operations=>rotate_right(
Line 395 ⟶ 366:
importing
e_value = result ).
write: `|a rotate rightrotr b -> `{ &&result }, { hex_converter=>to_decimal( result ) }, { hex_converter=>to_binary( result &&) `}|, `/.
&& hex_converter=>to_decimal( result ) && `, `
&& hex_converter=>to_binary( result ).
new-line.
</lang>
 
Line 404 ⟶ 372:
<pre>
a -> 000000FF, 255, 00000000000000000000000011111111
 
b -> 00000002, 2, 00000000000000000000000000000010
 
a and b -> 00000002, 2, 00000000000000000000000000000010
a or& b -> 000000FF00000002, 2552, 0000000000000000000000001111111100000000000000000000000000000010
 
a xor b -> 000000FD, 253, 00000000000000000000000011111101
a b -> 000000FF, 255, 00000000000000000000000011111111
complement a -> FFFFFF00, -256, 11111111111111111111111100000000
 
a shift left b -> 000003FC, 1020, 00000000000000000000001111111100
a xor^ b -> 000000FD, 253, 00000000000000000000000011111101
a shift right b -> 0000003F, 63, 00000000000000000000000000111111
 
(complement a) arithmetic shift left b -> FFFFFC00, -1024, 11111111111111111111110000000000
complement ~a -> FFFFFF00, -256, 11111111111111111111111100000000
(complement a) arithmetic shift right b -> FFFFFFC0, -64, 11111111111111111111111111000000
 
(complement a) rotate left b -> FFFFFC03, -1021, 11111111111111111111110000000011
a shift left<< b -> 000003FC, 1020, 00000000000000000000001111111100
a rotate right b -> C000003F, -1073741761, 11000000000000000000000000111111
 
a shift right>> b -> 0000003F, 63, 00000000000000000000000000111111
 
(complement ~a) arithmetic shift left<<< b -> FFFFFC00, -1024, 11111111111111111111110000000000
 
(complement ~a) arithmetic shift right>>> b -> FFFFFFC0, -64, 11111111111111111111111111000000
 
(complement ~a) rotate leftrotl b -> FFFFFC03, -1021, 11111111111111111111110000000011
 
a rotate rightrotr b -> C000003F, -1073741761, 11000000000000000000000000111111
</pre>
 
Anonymous user