Set right-adjacent bits: Difference between revisions
Content added Content deleted
(Added Go) |
m (→{{header|Go}}: Adjusted output slightly.) |
||
Line 288: | Line 288: | ||
e := len(bs) |
e := len(bs) |
||
n := test.n |
n := test.n |
||
fmt.Println("n =", n, "; Width e =", e, "\b:") |
fmt.Println("n =", n, "\b; Width e =", e, "\b:") |
||
fmt.Println(" Input b:", bs) |
fmt.Println(" Input b:", bs) |
||
bits := []byte(bs) |
bits := []byte(bs) |
||
Line 305: | Line 305: | ||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
n = 2 |
n = 2; Width e = 4: |
||
Input b: 1000 |
Input b: 1000 |
||
Result : 1110 |
Result : 1110 |
||
n = 2 |
n = 2; Width e = 4: |
||
Input b: 0100 |
Input b: 0100 |
||
Result : 0111 |
Result : 0111 |
||
n = 2 |
n = 2; Width e = 4: |
||
Input b: 0010 |
Input b: 0010 |
||
Result : 0011 |
Result : 0011 |
||
n = 2 |
n = 2; Width e = 4: |
||
Input b: 0000 |
Input b: 0000 |
||
Result : 0000 |
Result : 0000 |
||
n = 0 |
n = 0; Width e = 66: |
||
Input b: 010000000000100000000010000000010000000100000010000010000100010010 |
Input b: 010000000000100000000010000000010000000100000010000010000100010010 |
||
Result : 010000000000100000000010000000010000000100000010000010000100010010 |
Result : 010000000000100000000010000000010000000100000010000010000100010010 |
||
n = 1 |
n = 1; Width e = 66: |
||
Input b: 010000000000100000000010000000010000000100000010000010000100010010 |
Input b: 010000000000100000000010000000010000000100000010000010000100010010 |
||
Result : 011000000000110000000011000000011000000110000011000011000110011011 |
Result : 011000000000110000000011000000011000000110000011000011000110011011 |
||
n = 2 |
n = 2; Width e = 66: |
||
Input b: 010000000000100000000010000000010000000100000010000010000100010010 |
Input b: 010000000000100000000010000000010000000100000010000010000100010010 |
||
Result : 011100000000111000000011100000011100000111000011100011100111011111 |
Result : 011100000000111000000011100000011100000111000011100011100111011111 |
||
n = 3 |
n = 3; Width e = 66: |
||
Input b: 010000000000100000000010000000010000000100000010000010000100010010 |
Input b: 010000000000100000000010000000010000000100000010000010000100010010 |
||
Result : 011110000000111100000011110000011110000111100011110011110111111111 |
Result : 011110000000111100000011110000011110000111100011110011110111111111 |