Closed
Bug 795511
Opened 13 years ago
Closed 13 years ago
Remove usages of PR_BIT and PR_BITMASK from our tree
Categories
(Core :: General, defect)
Tracking
()
RESOLVED
FIXED
mozilla19
People
(Reporter: ehsan.akhgari, Assigned: avp)
References
(Blocks 1 open bug)
Details
(Whiteboard: [mentor=ehsan][lang=c++])
Attachments
(1 file, 1 obsolete file)
17.53 KB,
patch
|
ehsan.akhgari
:
review+
|
Details | Diff | Splinter Review |
PR_BIT(x) can be replaced with 0x1 << x.
Reporter | ||
Comment 1•13 years ago
|
||
PR_BITMASK should be easy too:
(0x1 << x) - 1
Summary: Remove usages of PR_BIT from our tree → Remove usages of PR_BIT and PR_BITMASK from our tree
Whiteboard: [mentor=ehsan][lang=c++]
Assignee | ||
Comment 2•13 years ago
|
||
Hi,
I would like to work on this bug. Could you please guide me to get started on it ? Which
must be the files that need to be edited ?
Thanks.
Reporter | ||
Comment 3•13 years ago
|
||
The guidelines here are quite similar to bug 795504 comment 2.
Please let me know if you need help. Thanks!
Assignee: nobody → abhishekp.bugzilla
Reporter | ||
Updated•13 years ago
|
Blocks: dieprtypesdie
Comment 4•13 years ago
|
||
(In reply to Ehsan Akhgari [:ehsan] from comment #0)
> PR_BIT(x) can be replaced with 0x1 << x.
One word of caution: 0x1U (or (uint32_t)1) is necessary to keep the expression from being undefined if bit 31 is to be set (Similarly for PR_BITMASK). There may also be cases where PR_BIT/PR_BITMASK is relied on to be an unsigned integer instead of a signed integer.
Comment 5•13 years ago
|
||
1u << x would be the most concise.
Reporter | ||
Comment 6•13 years ago
|
||
(In reply to comment #5)
> 1u << x would be the most concise.
True!
Updated•13 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 7•13 years ago
|
||
So should I replace PR_BIT with 1u << x and PR_BITMASK with (1u << x)-1 ?
Reporter | ||
Comment 8•13 years ago
|
||
(In reply to comment #7)
> So should I replace PR_BIT with 1u << x and PR_BITMASK with (1u << x)-1 ?
Sure.
Assignee | ||
Comment 9•13 years ago
|
||
Attachment #673174 -
Flags: feedback?(ehsan)
Comment 10•13 years ago
|
||
Comment on attachment 673174 [details] [diff] [review]
Removed usages of PR_BIT and PR_BITMASK from mozilla-central tree
>+#define DELAY_LINE_LENGTH_MASK (1u << DELAY_LINE_LENGTH_LOG2) - 1
>+#define DELAY_LINE_LENGTH 1u << DELAY_LINE_LENGTH_LOG2
Surround it with parenthesis. (Consider about how DELAY_LINE_LENGTH + 1 will be expanded.)
Reporter | ||
Comment 11•13 years ago
|
||
Comment on attachment 673174 [details] [diff] [review]
Removed usages of PR_BIT and PR_BITMASK from mozilla-central tree
Review of attachment 673174 [details] [diff] [review]:
-----------------------------------------------------------------
Looks very good, thanks Abhishek! Please address the following comments and attach another version of the patch for review.
::: xpcom/io/nsEscape.h
@@ +21,5 @@
> typedef enum {
> url_All = 0 /**< %-escape every byte unconditionally */
> +, url_XAlphas = 1u << 0 /**< Normal escape - leave alphas intact, escape the rest */
> +, url_XPAlphas = 1u << 1 /**< As url_XAlphas, but convert spaces (0x20) to '+' and plus to %2B */
> +, url_Path = 1u << 2 /**< As url_XAlphas, but don't escape slash ('/') */
Nit: please fix the indentation of the comments here.
::: xpcom/threads/TimerThread.h
@@ +72,5 @@
> nsTArray<nsTimerImpl*> mTimers;
>
> #define DELAY_LINE_LENGTH_LOG2 5
> +#define DELAY_LINE_LENGTH_MASK (1u << DELAY_LINE_LENGTH_LOG2) - 1
> +#define DELAY_LINE_LENGTH 1u << DELAY_LINE_LENGTH_LOG2
What Masatoshi said. :-)
Attachment #673174 -
Flags: feedback?(ehsan) → feedback+
Assignee | ||
Comment 12•13 years ago
|
||
Attachment #673174 -
Attachment is obsolete: true
Attachment #673506 -
Flags: review?(ehsan)
Reporter | ||
Comment 13•13 years ago
|
||
Comment on attachment 673506 [details] [diff] [review]
Removed usages of PR_BIT and PR_BITMASK from mozilla-central tree
Review of attachment 673506 [details] [diff] [review]:
-----------------------------------------------------------------
Looks great, thanks!
Attachment #673506 -
Flags: review?(ehsan) → review+
Reporter | ||
Comment 14•13 years ago
|
||
Comment 15•13 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
You need to log in
before you can comment on or make changes to this bug.
Description
•