Bug 29259 - Local variables 'k' and 'y' in s2b() in dtoa.cpp are computed but not used
Summary: Local variables 'k' and 'y' in s2b() in dtoa.cpp are computed but not used
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P3 Trivial
Assignee: Nobody
Depends on:
Reported: 2009-09-14 15:20 PDT by Wan-Teh Chang
Modified: 2010-08-26 01:55 PDT (History)
2 users (show)

See Also:

dtoa.diff (1.92 KB, patch)
2010-08-22 07:53 PDT, Xan Lopez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wan-Teh Chang 2009-09-14 15:20:46 PDT
In WebKit/JavaScriptCore/wtf/dtoa.cpp (r48248)
on the trunk, we have:

static void s2b(BigInt& b, const char* s, int nd0, int nd, uint32_t y9)
    int k;
    int32_t y;
    int32_t x = (nd + 8) / 9;

    for (k = 0, y = 1; x > y; y <<= 1, k++) { }

The local variables 'k' and 'y' are not used
after the for loop, so the variables 'k' and
'y' and the for loop can be deleted.

This is a cleanup of r43457.

Also, the macro Kmax is defined but not used:

#define Kmax 15

That definition can be deleted.
Comment 1 Wan-Teh Chang 2009-09-14 15:28:52 PDT
Re: Kmax

When dtoa.cpp was moved to WebKit/JavaScriptCore/wtf
in r38117, Kmax was already defined but not used.  I
didn't look further back in the history of dtoa.cpp.
Comment 2 Xan Lopez 2010-08-22 07:53:16 PDT
Created attachment 65060 [details]

Wan-Teh is right... the 'x' variable can also be removed, since it's only used in the loop.
Comment 3 Kent Tamura 2010-08-26 00:32:51 PDT
Comment on attachment 65060 [details]

Looks good.
Comment 4 Xan Lopez 2010-08-26 01:55:14 PDT
Comment on attachment 65060 [details]

Landed as r66089.
Comment 5 Xan Lopez 2010-08-26 01:55:25 PDT