❔ Data Parsing
Hello,I'm trying to built a simulation program by using windows forms application and I have a question:I want to parse a byte array bit by bit by using struct method and udp protocol.But I couldn't figure out how I can parse the byte array bit by bit.If someone can help I would appreciate it
11 Replies
What does "parse bit by bit" mean in your scenario?
most of the data I'm gonna parse is 1 bit length so ı need a way to parse byte array but each bit individually so that I can parse all the data I need
I don't know If I'm able to tell what I'm trying to say 🙂
Typically if you want to work with individual bits you would create a mask containing the bit you want to examine and then use bitwise and (the & operator) to test if that bit is set.
mtreit#6470
REPL Result: Success
Console Output
Compile: 521.753ms | Execution: 47.575ms | React with ❌ to remove this embed.
ok here you compartmentalize the data for specific byte value and within that value all the bits right ?
That code just walks the bit pattern from least significant bit to most significant bit (right to left, if you want to think of it that way) and outputs the bit value.
I understand
The opposite direction:
mtreit#6470
REPL Result: Success
Console Output
Compile: 572.280ms | Execution: 46.347ms | React with ❌ to remove this embed.
there's the BitArray class if you want to read the bits one by one
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.