lundi 17 décembre 2018

Create bit pattern that has, starting with the least significant bit, c0 bits 0 , then c1 bits of 1 , then c2 bits of 0 , etc

Create bit pattern

Write a function that reads a string of digits c0c1c2c3... until EOF or whitespace and returns the unsigned number that has, starting with the least significant bit, c0 bits of 0, then c1 bits of 1 , then c2 bits of 0 , etc. Stop when there are no more bits to fill, or fill any remaining bits with the opposite of the last bitspecified.

Aucun commentaire:

Enregistrer un commentaire