For the past weeks, I have been working on things dealing with hashing colors, and I saw a few issue with them. The following issue I experienced:
- If values are too large, then the value of hash would repeat.
- If values are too small, then the value of hash would repeat.
So, I had to modify my macro to account for the second case until today.
But, what if we can have these?
c2int(f32_value)* casts float32 values as a int representation of its binary.
*Double are treated as f32 here, casted to unsigned int
unsigned_mul(a,b,...) performs unsigned int multiplication and returns value.
Or just a hash function that does combines both. I think a direct hash function for math evaluator would be slightly faster. Also, I can see myself using direct hash function even outside colormap-like tools. I think they would need seed for it to work. _rep_colors_inform_r use two different hash values (primary, and merge hash).
For this:
#@cli rep_encode_str: string
#@cli : Encode string.
#@cli : Note: Every commas are eliminated.
rep_encode_str:
('{'$*'}') discard. 44 u {t} rm.
I wouldn’t even need to do this trick. And let the hash() does the encode.
There’s also the srand();v(large_value) trick too, but only works for scalar.