Closed Bug 1251366 Opened 8 years ago Closed 7 years ago

Consider cleaning up the bitfield in PrefTypeFlags in modules/libpref/prefapi.h

Categories

(Core :: Preferences: Backend, defect, P3)

Unspecified
All
defect

Tracking

()

RESOLVED DUPLICATE of bug 1418156
Tracking Status
firefox47 --- affected

People

(Reporter: milan, Assigned: milan)

References

Details

Attachments

(2 files)

See bug 1249157 comment 3.  We have a uint16_t that stores both the preference type (int, string, bool), as well as some flags about that preference (has default, etc.)
Bit fiddling being what it is, we could consider using bool:1 or some such to clean the code.  It would be all internal to PrefTypeFlags at this point, the implementation is not exposed outside the class.

One thing to consider is the size of PrefHashEntry (also in prefapi.h).  Bug 1248521 reduced the size from 40 to 32 bytes, if any work is done in this bug, it shouldn't increase that value.

For example, the "obvious":
PrefType
bool flag:1
bool flag:1
...
bool flag:1

gets us back to 40 bytes.
It seems we care about the size, so we would not want option 2.  Arguably, option 1 is still nicer code than the existing version.
Depends on: 1249157
OS: Unspecified → All
Assignee: nobody → milan
Priority: -- → P3
I ended up doing this in bug 1418156.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: