I have fixed the cast in hg. Thanks :) About the libm dependency. Do you think that feature (using log2) deserves to add another dep? I would prefer to keep it simple. The current algo is useful in most of cases.
On 01/03/2011, at 19:19, Glyn Kennington <[email protected]> wrote: > pancake wrote: >> I have also modified the pZ in order to display the entropy ranges >> from 0 to 255. > > Nice. But it needs to perform the cast *after* scaling. Try this: > > case 'e': // entropy > - ret = (unsigned char) (r_hash_entropy (bufz, size)*255)/8; > + ret = (unsigned char) (r_hash_entropy (bufz, size)*255/8); > break; > > Another adjustment that might be useful is for smaller buffers: when > size<256 (which can happen in zoom view with a large terminal and a > small file) the maximum is only log2(size). But that change means > adding a libm dependency to libr_core, or adding a wrapper function in > hash/entropy.c (r_hash_entropy_fraction?). > > Glyn > _______________________________________________ > radare mailing list > [email protected] > http://lists.nopcode.org/listinfo.cgi/radare-nopcode.org > _______________________________________________ radare mailing list [email protected] http://lists.nopcode.org/listinfo.cgi/radare-nopcode.org
