@cmuratori I was a bit confused in the Refterm cache lecture where you talked about hashing "a" + "0" + "1" etc to get an arbitrary amount of glyphs. How do you get the indices from the hash; isn't it a one way operation? Hope you can elaborate on that. Thank you!
-
-
Replying to @limdingwen
A strong hash can hash anything. The function you need is get_glyph(input_text, glyph_index). Since it is free to hash _both_ parameters - input_text and glyph_index - that's all you need. You just hash them together, and then use that as your lookup.
1 reply 0 retweets 0 likes -
Replying to @cmuratori @limdingwen
So the cost is that you have to do more lookups into the cache, the benefit is that you now can handle arbitrarily long sequences of glyphs. So it's a choice, and since the renderer was already 7000fps, I figured the correct choice was no limit on glyph counts :)
1 reply 0 retweets 0 likes -
Replying to @cmuratori
Oh, I think I get it! It's something like `cache[hash("the", 0)].value`, where the value is the index of the first glyph? Then we repeat for hash("the", 1), hash("the", 2), etc until we are unable to find the key. Thank you so much for replying btw! ^^
1 reply 0 retweets 0 likes -
Replying to @limdingwen @cmuratori
Edit: I realised refterm is open source, looking up the code :)
1 reply 0 retweets 0 likes
The code is here:https://github.com/cmuratori/refterm/blob/60e3eaf784098ba1f844e5599c359a3b727ddb5e/refterm_example_terminal.c#L482 …
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.