diff options
author | Neil Booth <neil@daikokuya.co.uk> | 2007-10-08 13:47:12 +0000 |
---|---|---|
committer | Neil Booth <neil@daikokuya.co.uk> | 2007-10-08 13:47:12 +0000 |
commit | 68e53ad6cb0a9d64d256f9dcef70331cd72d795e (patch) | |
tree | 4950f89a26f58ce497e0c332a4c1d2be75dc42a2 /include/llvm/ADT/APInt.h | |
parent | 633360c9d9312cd159ab4ef98e918924a06cfdbd (diff) | |
download | llvm-68e53ad6cb0a9d64d256f9dcef70331cd72d795e.tar.gz llvm-68e53ad6cb0a9d64d256f9dcef70331cd72d795e.tar.bz2 llvm-68e53ad6cb0a9d64d256f9dcef70331cd72d795e.tar.xz |
Add a new function tcExtract for extracting a bignum from an
arbitrary range of bits embedded in the middle of another bignum.
This kind of operation is desirable in many cases of software
floating point, e.g. converting bignum integers to floating point
numbers of fixed precision (you want to extract the precision most
significant bits).
Elsewhere, add an assertion, and exit the shift functions early if
the shift count is zero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42745 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/APInt.h')
-rw-r--r-- | include/llvm/ADT/APInt.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h index 61e8f52fc7..52c2fc01f1 100644 --- a/include/llvm/ADT/APInt.h +++ b/include/llvm/ADT/APInt.h @@ -1069,6 +1069,13 @@ public: /// Extract the given bit of a bignum; returns 0 or 1. Zero-based. static int tcExtractBit(const integerPart *, unsigned int bit); + /// Copy the bit vector of width srcBITS from SRC, starting at bit + /// srcLSB, to DST, of dstCOUNT parts, such that the bit srcLSB + /// becomes the least significant bit of DST. All high bits above + /// srcBITS in DST are zero-filled. + static void tcExtract(integerPart *, unsigned int dstCount, const integerPart *, + unsigned int srcBits, unsigned int srcLSB); + /// Set the given bit of a bignum. Zero-based. static void tcSetBit(integerPart *, unsigned int bit); |