This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913

--- Comment #5 from Marc Glisse <marc.glisse at normalesup dot org> 2011-03-01 22:15:48 UTC ---
Created attachment 23509
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23509
Overkill

I was having a hard time making it nice and clean, so I went for totally
overkill. It might be a bit scary to have 200 lines of code just to implement
an addition. And questionable whether avoiding a few overflows is worth the
complication. On the plus side, it makes it possible to give a simpler
implementation of ratio_less. And __safe_add can be removed (24 lines).

I'll try again to come up with a simpler solution.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]