This is an archive of the discontinued LLVM Phabricator instance.

Add control of hex casing in APInt::toString
ClosedPublic

Authored by thopre on May 18 2023, 9:13 AM.

Details

Summary

This will be used in implementing arbitrary precision support to
FileCheck's numeric variables and expressions.

Diff Detail

Event Timeline

thopre created this revision.May 18 2023, 9:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2023, 9:13 AM
thopre requested review of this revision.May 18 2023, 9:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2023, 9:13 AM
foad accepted this revision.May 18 2023, 9:21 AM

Looks fine to me.

This revision is now accepted and ready to land.May 18 2023, 9:21 AM
RKSimon accepted this revision.May 18 2023, 9:28 AM

LGTM

lattner added a comment.EditedMay 18 2023, 10:47 AM

I would suggest a silly microoptimization:

static const char BothDigits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
const char *Digits = BothDigits+(UpperCase ? 0 : 36);

Avoids looking up two different GOT entries.

This revision was automatically updated to reflect the committed changes.

I would suggest a silly microoptimization:

static const char BothDigits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
const char *Digits = BothDigits+(UpperCase ? 0 : 36);

Avoids looking up two different GOT entries.

Changed and landed.