MCPcopy Create free account
hub / github.com/ablab/spades / byteSwap

Method byteSwap

ext/src/llvm/APInt.cpp:674–694  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

672}
673
674APInt APInt::byteSwap() const {
675 assert(BitWidth >= 16 && BitWidth % 8 == 0 && "Cannot byteswap!");
676 if (BitWidth == 16)
677 return APInt(BitWidth, ByteSwap_16(uint16_t(U.VAL)));
678 if (BitWidth == 32)
679 return APInt(BitWidth, ByteSwap_32(unsigned(U.VAL)));
680 if (BitWidth <= 64) {
681 uint64_t Tmp1 = ByteSwap_64(U.VAL);
682 Tmp1 >>= (64 - BitWidth);
683 return APInt(BitWidth, Tmp1);
684 }
685
686 APInt Result(getNumWords() * APINT_BITS_PER_WORD, 0);
687 for (unsigned I = 0, N = getNumWords(); I != N; ++I)
688 Result.U.pVal[I] = ByteSwap_64(U.pVal[N - I - 1]);
689 if (Result.BitWidth != BitWidth) {
690 Result.lshrInPlace(Result.BitWidth - BitWidth);
691 Result.BitWidth = BitWidth;
692 }
693 return Result;
694}
695
696APInt APInt::reverseBits() const {
697 switch (BitWidth) {

Callers

nothing calls this directly

Calls 7

assertClass · 0.85
ByteSwap_16Function · 0.85
ByteSwap_32Function · 0.85
ByteSwap_64Function · 0.85
getNumWordsFunction · 0.85
lshrInPlaceMethod · 0.80
APIntFunction · 0.50

Tested by

no test coverage detected