![]() ![]() In the former case, the lookup table has to have 256 entries. Either the lookup table maps individual ascii hex characters to half bytes or it maps two hex characters to a full byte. I see two possible ways to solve this with a lookup table. As the question was how to convert files, our implementation should be fast on large data. ![]() Here is how I create a header with a character array "testdata" of 104857600 bytes, roughly 105 MB. Firstly, we want to have the whole test data in memory so that we avoid disk I/O influencing the test. Strangly enough, none of the answers above implement a purely arithmetic solution and some answers even assume that "converting to binary" means converting to a ascii string of characters "0" and "1". ![]() I wanted to find a solution which only uses a lookup table and benchmark that against a solution that uses arithmetics instead. There are many ways to solve this question that use some arithmetics to convert from ascii character ranges 0-9 and a-f (or A-F) to binary. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |