This is an archive of the discontinued LLVM Phabricator instance.

[libc] move int conversion out of base template
ClosedPublic

Authored by michaelrj on Aug 11 2022, 2:19 PM.

Details

Summary

The convert_alpha_numeric function is intentionally non-templated so
that its code can be reused for different bases in code-size sensitive
cases. Previously it was inside the IntegerToString class which created
a different version for each base.

Diff Detail

Event Timeline

michaelrj created this revision.Aug 11 2022, 2:19 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 11 2022, 2:19 PM
michaelrj requested review of this revision.Aug 11 2022, 2:19 PM
lntue accepted this revision.Aug 11 2022, 2:50 PM
This revision is now accepted and ready to land.Aug 11 2022, 2:50 PM
sivachandra accepted this revision.Aug 11 2022, 3:00 PM
sivachandra added inline comments.
libc/src/__support/integer_to_string.h
115

Will be interesting to see if this if is being optimized out because buffer is a constexpr in your use case.

michaelrj marked an inline comment as done.Aug 11 2022, 4:55 PM
michaelrj added inline comments.
libc/src/__support/integer_to_string.h
115

Yes at high enough optimization settings, along with everything else in this file except the main loop of convert_alpha_numeric and a couple other checks.

This revision was landed with ongoing or failed builds.Aug 11 2022, 4:56 PM
This revision was automatically updated to reflect the committed changes.
michaelrj marked an inline comment as done.