This is an archive of the discontinued LLVM Phabricator instance.

[Support] Add isShiftedUIntN to MathExtras.h
AcceptedPublic

Authored by craigblackmore on Nov 22 2021, 3:54 AM.

Details

Reviewers
luismarques
Summary

This is a non-templated version of isShiftedUInt which takes N and S as arguments.

Diff Detail

Event Timeline

craigblackmore created this revision.Nov 22 2021, 3:54 AM
craigblackmore requested review of this revision.Nov 22 2021, 3:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 22 2021, 3:54 AM

Can you add tests to unittests/Support/MathExtrasTest.cpp ?

llvm/include/llvm/Support/MathExtras.h
467

Assert that S > 0 like the template version.

Thanks for the review. I have added asserts and unit tests.

luismarques accepted this revision.Jul 5 2022, 6:59 AM
luismarques added a subscriber: luismarques.

LGTM.

llvm/unittests/Support/MathExtrasTest.cpp
501–504

Nit: not a blocker but adding some ' digit group separators would help with the readability of the large constant literals. Most of this file probably predates that C++ spec feature but we could add them as we go.

This revision is now accepted and ready to land.Jul 5 2022, 6:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 5 2022, 6:59 AM