Closed
Bug 898664
Opened 12 years ago
Closed 11 years ago
BinaryData uint64's are signed
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: bbenvie, Unassigned)
References
Details
Attachments
(1 file)
2.93 KB,
patch
|
Details | Diff | Splinter Review |
> uint64(-100) // -100
Reporter | ||
Comment 1•12 years ago
|
||
Also:
> var Foo = new ArrayType(uint64, 1);
> new Foo([-1]) // [-1]
Comment 2•12 years ago
|
||
uint32_t and uint64_t are reified as int32, as there is no template specialization for these types. However, they can overflow the range of an int32 (which happens here) and thus should be saved in a double if necessary. As far as I can see in Value.setNumber(x), if x can actually fit in an int32, it will be done, so we can just use setNumber.
Note that because of the loss of precision of high double values, uint64(-1) == uint64(-2) == uint64(-3), etc.
There is no other real choice as a JS value can only embed an int32 or a float64 value.
Attachment #783650 -
Flags: review?(nsm.nikhil)
749786 will introduce 64 bit types to JS userspace. I believe this bug should block on that.
Depends on: 749786
Comment on attachment 783650 [details] [diff] [review]
proposed fix
Review of attachment 783650 [details] [diff] [review]:
-----------------------------------------------------------------
Patch looks good. But lets wait before landing this. I was talking to Niko about the latest spec
and it seems 64 bit numbers might be out of the spec for now.
Attachment #783650 -
Flags: review?(nsm.nikhil)
Comment 5•12 years ago
|
||
(In reply to Nikhil Marathe [:nsm] from comment #3)
> 749786 will introduce 64 bit types to JS userspace. I believe this bug
> should block on that.
Oh! I wasn't aware of that, that's good to know :)
Comment 6•11 years ago
|
||
As of today:
js> TypedObject.uint32(-1)
4294967295
As the problem was concerning both uint32 and uint64 (which are not implemented right now) according to comment 2, I tentatively close the bug as wfm, but feel free to reopen it if it's not the case.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•