Page 2 of 2
Re: HEX string generating - extreme fast
Posted: Thu Nov 07, 2019 4:26 pm
by wilbert
swhite wrote:I would be helpful to have a PokeH() function as well that takes a Hex string and converts it to the binary ascii values.

There should be code on the forum like that.
What's important in this case is to decide if validation of the input is required.
If you know for sure that the input only contains hex characters, conversion can be done a lot faster compared to having to check each character and stop the conversion when a non hex character is encountered.
Re: HEX string generating - extreme fast
Posted: Thu Nov 07, 2019 5:28 pm
by Little John
wilbert wrote:swhite wrote:I would be helpful to have a PokeH() function as well that takes a Hex string and converts it to the binary ascii values.

There should be code on the forum like that.
I have posted functions
PeekHexBytes() and PokeHexBytes() more than 9 years ago.

That thread also contains code by other forum members.
wilbert wrote:What's important in this case is to decide if validation of the input is required.
If you know for sure that the input only contains hex characters, conversion can be done a lot faster compared to having to check each character and stop the conversion when a non hex character is encountered.
Both above mentioned functions are not optimized for speed, but written with safety and versatility in mind (however, I tried not to slow them down unnecessarily). This means that
PokeHexBytes() does validate its input.