Cyan4973 / FiniteStateEntropy

New generation entropy codecs : Finite State Entropy and Huff0
BSD 2-Clause "Simplified" License
1.33k stars 143 forks source link

argument order bug?!? #82

Closed aj664 closed 7 years ago

aj664 commented 7 years ago

on line 466 of fse_compress.c FSE_CTable* FSE_createCTable (unsigned maxSymbolValue, unsigned tableLog)

then on line 186 of fse.h
FSE_PUBLIC_API FSE_CTable* FSE_createCTable (unsigned tableLog, unsigned maxSymbolValue);

arguments are different order... which is correct? are callers to this function getting them backwards?

Cyan4973 commented 7 years ago

Spot on @aj664 ! Indeed, declaration and body do not correspond, this is quite an issue !

The correct version is the one implemented in fse_compress.c.

It's impressive it slipped through, though this can be explained by the fact that both arguments have same type. I suspect few programs use this interface, and those that do already use the "correct" argument order, as tableLog maximum value is fairly low, resulting in instant failure when crossed.