Open Bug 1130158 Opened 5 years ago Updated 5 years ago

NS_PTR_TO_INT32() seems like a bad idea

Categories

(Core :: XPCOM, defect)

defect
Not set

Tracking

()

People

(Reporter: mccr8, Unassigned)

References

(Depends on 1 open bug)

Details

In the modern world where we use 64-bit pointers, this seems like a pretty sketchy idea.  Even when this is used as part of a hash function, surely we can do better?
Relatedly, there's NS_PTR_TO_UINT32(), which is used in similar ways, like in nsHashKeys:
  NS_PTR_TO_UINT32(aKey) >> 2
NS_INT32_TO_PTR, too! Yikes.
A number of these conversions are used to store ints in untyped hash tables, so those should be "ok".  Modernizing these hash tables is probably the best fix for that.
Depends on: 1134853
You need to log in before you can comment on or make changes to this bug.