splitting a block of 256 bytes in 64 values

Post any examples or modules that you want to share here
Post Reply
rob.keij
Posts: 13
Joined: Mon May 25, 2015 9:23 pm
Location: IJmuiden the Netherlands
Contact:

splitting a block of 256 bytes in 64 values

Post by rob.keij »

I have 64 16 bit numbers which I convert to a HEX format.
The HEX format will consist of 4 bytes with ASCII characters.
In this way, it is good to process the data to eventually again to have a decimal number.

I ask every time 64 values so 256 bytes at a time.

1) I divide it into sections of 256 bytes 32 bytes. (splitter looks only to the first 50 elements so I have to split)
2) then I divide it into portions of 4 bytes
3) this HEX value I turn then to a decimal value

However, this module is large and slow. I think it can be easily solved with a Ruby module.
I have a ruby module that views 64 values as lines on display and it should be easy in ruby to split fast the 256 Bytes in 64 values (I think).

I am a C programmer and am trying to use ruby but not quite succeed... (I'm working on it!! :D )

can anyone push me in the right direction to make a good start to accelerate this module in Ruby.

Or am I mistaken and this module can not faster?

channel.fsm
module for splitting a block of 256 bytes in 64 values
(2.27 KiB) Downloaded 1024 times
User avatar
MyCo
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany
Contact:

Re: splitting a block of 256 bytes in 64 values

Post by MyCo »

like that?
Attachments
hex_unpack (MyCo).fsm
(498 Bytes) Downloaded 1043 times
rob.keij
Posts: 13
Joined: Mon May 25, 2015 9:23 pm
Location: IJmuiden the Netherlands
Contact:

Re: splitting a block of 256 bytes in 64 values

Post by rob.keij »

Thanks, this is a good starting point I work it out....
rob.keij
Posts: 13
Joined: Mon May 25, 2015 9:23 pm
Location: IJmuiden the Netherlands
Contact:

Re: splitting a block of 256 bytes in 64 values

Post by rob.keij »

@MyCo

Thanks MyCo, I'm a lot further now, The speed is good, and I'm working on the next problem to solve.

Thanks,



Rob
Post Reply