Re: o3tl::make_unsigned

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday 30 of January 2020, Kaganski Mike wrote:
> Can the hypothetical make_signed function return a signed integer when
> there's a bigger integer type exist,

 Yes.

> and a struct with overloaded 
> operator<=> when there's not, and that overloaded operator<=> would
> check if contained unsigned value is greater than max value of its
> signed argument, and return "contained unsigned is greater than passed
> signed" in that case, otherwise fallback to "convert unsigned to signed
> and compare normally" strategy? This would comply with the scope of the
> function (which, as I understand it, to only be used in preparation to
> comparison), always return mathematically correct result of comparison,
> and allow all smaller types comparison to still be without overhead?
> (But for 64-bit unsigned types, of course, it will introduce the
> overhead. Will it be significant, though?)

 Not worth it. That'd be like doing error checking for every memory 
allocation - we also bother only with those few cases where it realistically 
can go wrong.

-- 
 Luboš Luňák
 l.lunak@xxxxxxxxxxxxx
_______________________________________________
LibreOffice mailing list
LibreOffice@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/libreoffice




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux