diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2011-02-26 22:03:50 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2011-02-26 22:03:50 +0000 |
commit | d0e4e96dc17a6c1c6de3340842c80f0e187ba349 (patch) | |
tree | ddf53b8bd9235bcb0b8aae16c5e22310dcdad665 /include/llvm/ADT | |
parent | cf099d11218cb6f6c5cce947d6738e347f07fb12 (diff) |
Notes
Diffstat (limited to 'include/llvm/ADT')
-rw-r--r-- | include/llvm/ADT/APInt.h | 6 | ||||
-rw-r--r-- | include/llvm/ADT/ArrayRef.h | 5 | ||||
-rw-r--r-- | include/llvm/ADT/ImmutableIntervalMap.h | 2 | ||||
-rw-r--r-- | include/llvm/ADT/ImmutableMap.h | 2 |
4 files changed, 12 insertions, 3 deletions
diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h index b91d5dc9bcf9..d1fd3e5034bf 100644 --- a/include/llvm/ADT/APInt.h +++ b/include/llvm/ADT/APInt.h @@ -1193,6 +1193,12 @@ public: /// @brief Count the number of leading one bits. unsigned countLeadingOnes() const; + /// Computes the number of leading bits of this APInt that are equal to its + /// sign bit. + unsigned getNumSignBits() const { + return isNegative() ? countLeadingOnes() : countLeadingZeros(); + } + /// countTrailingZeros - This function is an APInt version of the /// countTrailingZeros_{32,64} functions in MathExtras.h. It counts /// the number of zeros from the least significant bit to the first set bit. diff --git a/include/llvm/ADT/ArrayRef.h b/include/llvm/ADT/ArrayRef.h index 1c5470d678b6..d3ea9c0f03b7 100644 --- a/include/llvm/ADT/ArrayRef.h +++ b/include/llvm/ADT/ArrayRef.h @@ -64,7 +64,10 @@ namespace llvm { /*implicit*/ ArrayRef(const std::vector<T> &Vec) : Data(Vec.empty() ? (T*)0 : &Vec[0]), Length(Vec.size()) {} - // TODO: C arrays. + /// Construct an ArrayRef from a C array. + template <size_t N> + /*implicit*/ ArrayRef(const T (&Arr)[N]) + : Data(Arr), Length(N) {} /// @} /// @name Simple Operations diff --git a/include/llvm/ADT/ImmutableIntervalMap.h b/include/llvm/ADT/ImmutableIntervalMap.h index d3196ca23df9..0d8fcf343385 100644 --- a/include/llvm/ADT/ImmutableIntervalMap.h +++ b/include/llvm/ADT/ImmutableIntervalMap.h @@ -215,7 +215,7 @@ public: ImmutableIntervalMap add(ImmutableIntervalMap Old, key_type_ref K, data_type_ref D) { - TreeTy *T = F.add(Old.Root, std::make_pair<key_type, data_type>(K, D)); + TreeTy *T = F.add(Old.Root, std::pair<key_type, data_type>(K, D)); return ImmutableIntervalMap(F.getCanonicalTree(T)); } diff --git a/include/llvm/ADT/ImmutableMap.h b/include/llvm/ADT/ImmutableMap.h index e439a0994821..d6cce7ccfa05 100644 --- a/include/llvm/ADT/ImmutableMap.h +++ b/include/llvm/ADT/ImmutableMap.h @@ -108,7 +108,7 @@ public: ImmutableMap getEmptyMap() { return ImmutableMap(F.getEmptyTree()); } ImmutableMap add(ImmutableMap Old, key_type_ref K, data_type_ref D) { - TreeTy *T = F.add(Old.Root, std::make_pair<key_type,data_type>(K,D)); + TreeTy *T = F.add(Old.Root, std::pair<key_type,data_type>(K,D)); return ImmutableMap(Canonicalize ? F.getCanonicalTree(T): T); } |