You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

650 B

reversebits

Instructions

Écrire une fonction qui prend un byte, qui l'inverse bit par bit (comme montré sur l'exemple) et qui retourne le résultat.

Fonction attendue

func ReverseBits(by byte) byte {

}

Utilisation

Voici un programme possible pour tester votre fonction :

package main

import (
	"fmt"
)

func main() {
	a := byte(0x26)
	fmt.Printf("%08b\n", a)
	fmt.Printf("%08b\n", ReverseBits(a))
}

et son résultat :

student@ubuntu:~/piscine-go/reversebits$ go build
student@ubuntu:~/piscine-go/reversebits$ ./reversebits
00100110
01100100
student@ubuntu:~/piscine-go/reversebits$