Page MenuHomePhabricator

[APInt] New member function setBitVal
ClosedPublic

Authored by foad on Wed, Sep 2, 8:39 AM.

Diff Detail

Event Timeline

foad created this revision.Wed, Sep 2, 8:39 AM
foad requested review of this revision.Wed, Sep 2, 8:39 AM

LGTM

llvm/include/llvm/ADT/APInt.h
1454

I think setBitVal() might be better.

RKSimon added inline comments.
llvm/include/llvm/ADT/APInt.h
1454

+1

RKSimon added inline comments.Wed, Sep 2, 10:11 AM
llvm/include/llvm/ADT/APInt.h
1454

Would it be simpler if we just did:

if (BitValue)
  setBit(BitPosition);
else
  clearBit(BitPosition);
foad added inline comments.Wed, Sep 2, 11:28 AM
llvm/include/llvm/ADT/APInt.h
1454

OK. I was trying to reduce the number of conditional branches but maybe it's not helpful in this case.

foad updated this revision to Diff 289525.Wed, Sep 2, 12:02 PM

Rename to setBitVal and change implementation.

foad retitled this revision from [APInt] New member function setBitTo to [APInt] New member function setBitVal.Wed, Sep 2, 12:05 PM
andreadb accepted this revision.Wed, Sep 2, 12:22 PM

Looks good to me.

This revision is now accepted and ready to land.Wed, Sep 2, 12:22 PM
This revision was landed with ongoing or failed builds.Wed, Sep 2, 1:57 PM
This revision was automatically updated to reflect the committed changes.