Closed Bug 685322 Opened 13 years ago Closed 13 years ago

Create implicit constructors on floating-point types taking integer types

Categories

(Core :: Graphics, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla11

People

(Reporter: joe, Assigned: joe)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch Implicitly convert (obsolete) — Splinter Review
This patch lets us implicitly convert from an Int{Point,Size,Rect} to a {Point,Size,Rect}, which is non-lossy and therefore should be supported!

It also corrects a typo in the template parameters for IntPoint:

-struct IntPoint :
-  public BasePoint<int32_t, Point> {
-  typedef BasePoint<int32_t, Point> Super;
Attachment #558971 - Flags: review?(roc)
Bas rightfully points out that int -> float is lossy, since float can only represent 23 bits of fraction. (int->double would be non-lossy, though.) Therefore, I'm going to commit an explicit version of this patch. Carrying over r+ since this is strictly safer.
Assignee: nobody → joe
Attachment #558971 - Attachment is obsolete: true
Attachment #565709 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/677fe017e6a0
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla11
Blocks: 703028
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: