You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by Noel Grandin <no...@gmail.com> on 2010/06/18 11:20:37 UTC
why is Span#getLength() long?
Hi
Is there a reason Span#getLength() returns a long?
Since start and end are int's, it seems like getLength() should also be
an int.
Regards, Noel Grandin
Re: why is Span#getLength() long?
Posted by Greg Brown <gk...@mac.com>.
It is because the length of the span can overflow the range supported by the int type. However, in verifying this, I discovered a bug in the calculation - because the values were not being cast to long beforehand, they were being evaluated as ints and overflowing anyways. Thanks for catching this.
On Jun 18, 2010, at 5:20 AM, Noel Grandin wrote:
> Hi
>
> Is there a reason Span#getLength() returns a long?
> Since start and end are int's, it seems like getLength() should also be
> an int.
>
> Regards, Noel Grandin