0

I have a bit-wise coded value 0b00100110 and I want to extract an array of int with bit-positions like [2,3,6].

I am very new to golang, so coming from C I would do this algorithmically. But I would like it to do the go-way

Peter Miehle
  • 5,984
  • 2
  • 38
  • 55
  • 3
    Why is algorithmically not the "go-way"? Just fill your slice with every 1 you find. – Volker Nov 18 '16 at 14:20
  • 3
    The algorithm to output indicies of the 1 bits can be found in this related question: [Bitmasking conversion of CPU ids with Go](http://stackoverflow.com/questions/40235464/bitmasking-conversion-of-cpu-ids-with-go/40235914#40235914) – icza Nov 18 '16 at 14:23

0 Answers0