Page 1 of 1

splitting a block of 256 bytes in 64 values

Posted: Sun Jun 14, 2015 8:20 am
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

Re: splitting a block of 256 bytes in 64 values

Posted: Sun Jun 14, 2015 8:41 am
by MyCo
like that?

Re: splitting a block of 256 bytes in 64 values

Posted: Sun Jun 14, 2015 9:05 am
by rob.keij
Thanks, this is a good starting point I work it out....

Re: splitting a block of 256 bytes in 64 values

Posted: Sun Jun 14, 2015 10:40 pm
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