This is an archive of the discontinued LLVM Phabricator instance.

[libc][nfc] add CPP Limits.h for numeric_limits
ClosedPublic

Authored by michaelrj on Aug 12 2021, 11:34 AM.

Details

Summary

Add an implementation of numeric_limits for use in str_conv_utils.
It currently only supports the basic integer types, with more types
coming as needed.

Diff Detail

Event Timeline

michaelrj created this revision.Aug 12 2021, 11:34 AM
michaelrj requested review of this revision.Aug 12 2021, 11:34 AM
sivachandra added inline comments.Aug 12 2021, 11:52 AM
libc/utils/CPP/Limits.h
15

Move this outside of the namespace?

17

Name the class NumericLimits to follow the convention of the rest of CPP utils.

19

Make these static methods constexpr also.

michaelrj updated this revision to Diff 366092.Aug 12 2021, 1:42 PM
michaelrj marked 3 inline comments as done.

Rename numeric_limits to NumericLimits and make all the functions constexpr.

sivachandra accepted this revision.Aug 12 2021, 1:58 PM
sivachandra added inline comments.
libc/utils/CPP/Limits.h
23

Add a TODO saying specializations will be added as needed.

This revision is now accepted and ready to land.Aug 12 2021, 1:58 PM
michaelrj updated this revision to Diff 366097.Aug 12 2021, 2:17 PM

add a comment with a todo

michaelrj marked an inline comment as done.Aug 12 2021, 2:17 PM
This revision was landed with ongoing or failed builds.Aug 12 2021, 2:31 PM
This revision was automatically updated to reflect the committed changes.