[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Ccrtp-devel] timevalIntervalTo65536 function
From: |
Federico Montesino Pouzols |
Subject: |
Re: [Ccrtp-devel] timevalIntervalTo65536 function |
Date: |
Wed, 27 Apr 2005 11:55:36 +0200 |
User-agent: |
Mutt/1.5.8i |
Right, those values of tv_usec higher than 524288 :) would be wrongly
interpreted as negative values. It's also fixed in CVS. Thanks!
On Mon, Apr 25, 2005 at 09:53:26PM +0900, Takegami, Takashi wrote:
> Hello,
>
> I have a question in timevalIntervalTo65536 function (rtcppkt.cpp).
> Doesn't it output wrong value? t.tv_usec has the value of minus,
> after "t.tv_usec << 12".
>
> For example,
> t.tv_usec = 900000(10) = 00000000000011011011101110100000(2)
> "t.tv_usec << 12" then, 1101101110111010000000...(2)
> In this case, t.tv_usec has the value of minus, because t.tv_usec is
> not uint32.
> So that, timevalIntervalTo65536 function outputs more smaller value
> than the right value.
>
>
> - result += (t.tv_usec << 12) / 125000 * 2;
> + result += ((unsigned int)(t.tv_usec << 12)) / 125000 * 2;
>
>
> Hope this helps.
> --
> TAKEGAMI
>
>
> _______________________________________________
> Ccrtp-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/ccrtp-devel