b. Implements Bitwise Operations |
initial writing: 2001-11-22 last updated: 2004-10-26 |
m b."r | monad and dyad | ||
m b./ | monad and dyad | ||
m b./\ | monad | ||
m b./\. | monad |
12345 (17 b.) 67890 bitwise and 48 f=: (32#2)&#: { '.x'"_ f 12345 67890 48 ..................xx......xxx..x ...............x....x..x..xx..x. ..........................xx.... _12345 (23 b.) 67890 bitwise or _12297 f _12345 67890 _12297 xxxxxxxxxxxxxxxxxx..xxxxxx...xxx ...............x....x..x..xx..x. xxxxxxxxxxxxxxxxxx..xxxxxxxx.xxx 20 b./~ i.10 bitwise less than table 0 1 2 3 4 5 6 7 8 9 0 0 2 2 4 4 6 6 8 8 0 1 0 1 4 5 4 5 8 9 0 0 0 0 4 4 4 4 8 8 0 1 2 3 0 1 2 3 8 9 0 0 2 2 0 0 2 2 8 8 0 1 0 1 0 1 0 1 8 9 0 0 0 0 0 0 0 0 8 8 0 1 2 3 4 5 6 7 0 1 0 0 2 2 4 4 6 6 0 0 23 b./\ 2^i.10 cumulative bitwise or 1 3 7 15 31 63 127 255 511 1023 _5 (33 b.) 12345 shift 385 f 12345 385 ..................xx......xxx..x .......................xx......x _5 (33 b.) _12345 shift 134217342 f _12345 134217342 xxxxxxxxxxxxxxxxxx..xxxxxx...xxx .....xxxxxxxxxxxxxxxxxx..xxxxxx. _5 (34 b.) _12345 signed shift _386 f _12345 _386 xxxxxxxxxxxxxxxxxx..xxxxxx...xxx xxxxxxxxxxxxxxxxxxxxxxx..xxxxxx.