[Webkit-unassigned] [Bug 136981] ArgumentEncoder::encode does not support long long

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Oct 21 00:02:47 PDT 2014


https://bugs.webkit.org/show_bug.cgi?id=136981

--- Comment #14 from Zan Dobersek <zandobersek at gmail.com> ---
Comment on attachment 238475
  --> https://bugs.webkit.org/attachment.cgi?id=238475
Cast std::chrono::duration.count() to int64_t in ArgumentCoder

View in context: https://bugs.webkit.org/attachment.cgi?id=238475&action=review

>>> Source/WebKit2/Platform/IPC/ArgumentCoders.h:110
>>> +        encoder << static_cast<int64_t>(duration.count());
>> 
>> What guarantees that int64_t is big enough for Rep? Or that Rep is not a double?
>> 
>> I think that we need either a more specific coder, or a compile time assertion.
> 
> I don't know whether int64_t is big enough, but I can make sure Rep is an integer.
> The standard says: typedef duration<signed integer type of at least 45 bits, milli> milliseconds;
> 
> Do we really needs a type which is larger than int64_t to represent time? int64_t is already very large.

How about a static_assert here that checks that Rep is a signed 64-bit integer type? Something like:

    static_assert(std::is_integral<Rep>::value && std::is_signed<Rep>::value && sizeof(Rep) == sizeof(int64_t), "Just to be sure.");

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20141021/742222da/attachment-0002.html>


More information about the webkit-unassigned mailing list