Bug in erl_interface in R9C?

Javier París Fernández paris@REDACTED
Thu Aug 21 17:37:25 CEST 2003


Hi,

On Wed, Aug 20, 2003 at 05:38:40PM -0300, Roberto Amorim wrote:
> > The result of get8(s) << shift is an integer, but when the shift makes the
> > number bigger than 2^32 the remaining bits are discarded. Putting a cast
> > to force the result to be 64 bits solves the problem.
> 
> What about the performance? Unnecessary casts are a common source of
> unwanted performance problems.

Well, the code is only used with integers bigger than 2^32, so it does not
affect normal integer decoding. The easy way to avoid making unnecessary
casts would be to unroll the loop, but i don't think it's worth the effort.

The nice way would be to read the number from s backwards, and shift n
instead of the number from get8(s), but that would need changes to the
putget functions. That would be nice, but i don't think the performance hit
is that big to justify the change. 

Regards.




More information about the erlang-questions mailing list