Switch from string keys to ReadOnlyMemory<byte>#1
Switch from string keys to ReadOnlyMemory<byte>#1NickStrupat wants to merge 3 commits intoodinmillion:masterfrom
Conversation
|
Amazing PR! It is a good proposal to generalize library. I am a little bit confused on this line: https://github.com/odinmillion/Phf.Net/pull/1/files#diff-c0abc29d441dd7573197a5233567ba9bR196 |
|
Ah yes, I missed that. Should the 16 be 8? In both places (https://github.com/odinmillion/Phf.Net/pull/1/files#diff-c0abc29d441dd7573197a5233567ba9bR207) |
|
It should be a little trickier) In case of C# strings we map each char to 2 bytes. Therefore we have only 2 possibilities: zero bytes remainder (str.Length % 2 == 0) and 2 bytes reminder (str.Length % 2 == 1). After switching to the bytes we have 4 possibilities for remainder length: 0, 1, 2, 3. Therefore we have to handle all that cases. Later I will try to implement this. |
This way, any byte-representation can be used as a key.