1

I have written a code in c++ like this:

    struct ds{        
    bitset<3> counter;
    bitset<29> encoding;
    }

    vector<ds> lists;

I want to have an array of ds,where each cell can store 3 bits counter and 29 bits encoding separately. I want to write it in python.How to do it?

  • counter & encoding, they both're integers? – hygull Jun 16 '18 at 18:16
  • yes...but i truncate them to 3 bits for counter and 29 bits for encoding... – bhavya nigam Jun 17 '18 at 21:31
  • **@Bhvya**, you can check this http://bitstruct.readthedocs.io/en/latest/#example-usage. I can't answer here as I don't see answer box. Better is to check my gist available at https://gist.github.com/hygull/36858bdd4cf7a2b3df248d5307bc7d64. Here I have written a small note regarding this bitstruct. – hygull Jun 18 '18 at 05:25

0 Answers0