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
This commit is contained in:
Neil Booth
2007-10-08 13:47:12 +00:00
parent 633360c9d9
commit 68e53ad6cb
2 changed files with 83 additions and 34 deletions
+7
View File
@@ -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);