Closed
Bug 409324
Opened 17 years ago
Closed 17 years ago
js_DoubleToECMA(u)Int32 should return jsdouble, not a useless always-true JSBool
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
People
(Reporter: Waldo, Assigned: sayrer)
References
Details
Attachments
(1 file, 2 obsolete files)
7.49 KB,
patch
|
sayrer
:
review+
sayrer
:
approval1.9+
|
Details | Diff | Splinter Review |
...from bug 409302 comment 3.
Assignee | ||
Comment 1•17 years ago
|
||
Attachment #294238 -
Flags: review?(brendan)
Comment 2•17 years ago
|
||
Comment on attachment 294238 [details] [diff] [review]
change the return type
>+js_DoubleToECMAInt32(jsdouble d)
> {
> jsdouble two32 = 4294967296.0;
> jsdouble two31 = 2147483648.0;
>
> if (!JSDOUBLE_IS_FINITE(d) || d == 0) {
>- *ip = 0;
>- return JS_TRUE;
>+ return 0;
> }
Nit: house style does not over-brace single-line consequents.
>+ return (d >= two31) ? (d - two32) : d;
Warning bait on some compilers? Previous code had (int32) cast to show intentional narrowing.
>+uint32
>+js_DoubleToECMAUint32(jsdouble d)
Same two comments apply to this function.
r/a=me with those fixed, please set flags on final checked-in patch. Thanks,
/be
Attachment #294238 -
Flags: review?(brendan)
Attachment #294238 -
Flags: review+
Attachment #294238 -
Flags: approval1.9+
Comment 3•17 years ago
|
||
I saw Waldo suggesting a few more things on IRC...
/be
Assignee: general → sayrer
Assignee | ||
Comment 4•17 years ago
|
||
local var elimination as suggested by waldo
Attachment #294238 -
Attachment is obsolete: true
Attachment #294256 -
Flags: review?(brendan)
Assignee | ||
Updated•17 years ago
|
Attachment #294238 -
Flags: review+
Attachment #294238 -
Flags: approval1.9+
Comment 5•17 years ago
|
||
Comment on attachment 294256 [details] [diff] [review]
fix nits, eliminate some locals in jsparse.c
Final nit:
>+ return (int32) ((d >= two31) ? (d - two32) : d);
No need to over-parenthesize the subtraction expression. r=me with that picked.
/be
Attachment #294256 -
Flags: review?(brendan) → review+
Updated•17 years ago
|
Attachment #294256 -
Flags: approval1.9+
Assignee | ||
Comment 6•17 years ago
|
||
Attachment #294256 -
Attachment is obsolete: true
Attachment #294280 -
Flags: review+
Attachment #294280 -
Flags: approval1.9+
Assignee | ||
Updated•17 years ago
|
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Is js_DoubleToECMAInt32 a special case or is this code pattern (function always returns true) something that should be eliminated in general? For example, js_ValueToBoolean could benefit from a similar makeover, too.
Updated•17 years ago
|
Flags: in-testsuite-
Flags: in-litmus-
You need to log in
before you can comment on or make changes to this bug.
Description
•