This is an archive of the discontinued LLVM Phabricator instance.

APFloat: Add getExactLog2Abs
ClosedPublic

Authored by arsenm on Aug 16 2023, 11:14 AM.

Details

Summary

Like the recently added getExactLog2 except ignore the sign bit.

Diff Detail

Event Timeline

arsenm created this revision.Aug 16 2023, 11:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 16 2023, 11:14 AM
arsenm requested review of this revision.Aug 16 2023, 11:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 16 2023, 11:14 AM
Herald added a subscriber: wdng. · View Herald Transcript
sepavloff added inline comments.Aug 17 2023, 4:22 AM
llvm/include/llvm/ADT/APFloat.h
494–495

It looks like using std::optional<int> as return value can produce clearer interface, no?

arsenm added inline comments.Aug 17 2023, 5:35 AM
llvm/include/llvm/ADT/APFloat.h
494–495

It shouldn’t differ from the non-abs version. I also don’t think optional is any nicer here

sepavloff accepted this revision.Aug 18 2023, 10:55 AM

LGTM.

llvm/include/llvm/ADT/APFloat.h
500

inline is excessive here, a member function defined in its class definition is inline (https://eel.is/c++draft/class.mfct#1).

This revision is now accepted and ready to land.Aug 18 2023, 10:55 AM