|
|
|
@ -2,26 +2,20 @@
|
|
|
|
|
|
|
|
|
|
### Instructions |
|
|
|
|
|
|
|
|
|
Write a function that takes a `byte`, that reverses it `bit` by `bit` (like the |
|
|
|
|
example) and that returns the result. |
|
|
|
|
Write a program that takes a `byte` in binary format and that reverses it `bit` by `bit` (like the |
|
|
|
|
example) |
|
|
|
|
|
|
|
|
|
### Expected function |
|
|
|
|
### Expected output |
|
|
|
|
|
|
|
|
|
```go |
|
|
|
|
func ReverseBits(octet byte) byte { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
Example: |
|
|
|
|
|
|
|
|
|
1 byte |
|
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
``` |
|
|
|
|
00100110 |
|
|
|
|
|| |
|
|
|
|
\/ |
|
|
|
|
```console |
|
|
|
|
student@ubuntu:~/piscine-go/reversebits$ go build |
|
|
|
|
student@ubuntu:~/piscine-go/reversebits$ ./reversebits |
|
|
|
|
Not enough arguments. |
|
|
|
|
student@ubuntu:~/piscine-go/reversebits$ ./reversebits 00100110 |
|
|
|
|
01100100 |
|
|
|
|
student@ubuntu:~/piscine-go/reversebits$ ./reversebits "djs" |
|
|
|
|
The argument "djs" doesn't represent a byte |
|
|
|
|
student@ubuntu:~/piscine-go/reversebits$ ./reversebits "0102039s" |
|
|
|
|
The argument "0102039s" doesn't represent a byte |
|
|
|
|
student@ubuntu:~/piscine-go/reversebits$ |
|
|
|
|
``` |
|
|
|
|