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

Method zext

ext/src/llvm/APInt.cpp:935–951  ·  view source on GitHub ↗

Zero extend to a new width.

Source from the content-addressed store, hash-verified

933
934// Zero extend to a new width.
935APInt APInt::zext(unsigned width) const {
936 assert(width > BitWidth && "Invalid APInt ZeroExtend request");
937
938 if (width <= APINT_BITS_PER_WORD)
939 return APInt(width, U.VAL);
940
941 APInt Result(getMemory(getNumWords(width)), width);
942
943 // Copy words.
944 std::memcpy(Result.U.pVal, getRawData(), getNumWords() * APINT_WORD_SIZE);
945
946 // Zero remaining words.
947 std::memset(Result.U.pVal + getNumWords(), 0,
948 (Result.getNumWords() - getNumWords()) * APINT_WORD_SIZE);
949
950 return Result;
951}
952
953APInt APInt::zextOrTrunc(unsigned width) const {
954 if (BitWidth < width)

Callers 4

toStringMethod · 0.80
getAsIntegerMethod · 0.80
rotateModuloFunction · 0.80
isSameValueFunction · 0.80

Calls 5

assertClass · 0.85
getMemoryFunction · 0.85
getNumWordsFunction · 0.85
getRawDataFunction · 0.85
APIntFunction · 0.50

Tested by

no test coverage detected