Mir

Code review comment for lp:~alan-griffiths/mir/fix-1717061

Revision history for this message
Gerry Boland (gerboland) wrote :

+unsigned clamp_dim(unsigned dim)
+{
+ return std::min<unsigned long>(std::numeric_limits<long>::max(), dim);
+}

Why max "long" - the signedness of it confuses me. What is this clamping "dim" to?

If sizeof(unsigned) < sizeof(long), this always returns "dim", so the only interesting case is if sizeof(unsigned) == sizeof(long), where this clamps dim in the bottom 1/2 of the unsigned ints. Intended?

review: Needs Information

« Back to merge proposal