ffmpeg - Purpose of XOR-ing with 0? -


so have static hash table , before adding code in table, index being xor-ed 0. why case if index of table declared integer?

h = 0; h ^= (i << lzw_hash_shift); if (h >= lzw_hash_size) {     h -= lzw_hash_size; } s->tab[h].code = i; s->tab[h].suffix = i; s->tab[h].hash_prefix = lzw_prefix_empty; 

this source code part of ffmpeg lzw encoder lib.

in original code, hash function called other places in code, , makes no sense duplicate function avoid 1 line in special case when line nothing. thus, nothing when called cleartable (wasting negligible amount of time), sensible when called parameter not zero.

in case, sole purpose showcase how blind copy-pasting bad, suppose :)


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -