diff options
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/SubtargetFeature.cpp | 5 | ||||
-rw-r--r-- | lib/Target/X86/X86FloatingPoint.cpp | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/Target/SubtargetFeature.cpp b/lib/Target/SubtargetFeature.cpp index c9ddaf74b8..7856ddb66a 100644 --- a/lib/Target/SubtargetFeature.cpp +++ b/lib/Target/SubtargetFeature.cpp @@ -112,10 +112,13 @@ void SubtargetFeatures::AddFeature(const std::string &String, /// Find KV in array using binary search. template<typename T> const T *Find(const std::string &S, const T *A, size_t L) { + // Make the lower bound element we're looking for + T KV; + KV.Key = S.c_str(); // Determine the end of the array const T *Hi = A + L; // Binary search the array - const T *F = std::lower_bound(A, Hi, S); + const T *F = std::lower_bound(A, Hi, KV); // If not found then return NULL if (F == Hi || std::string(F->Key) != S) return NULL; // Return the found array item diff --git a/lib/Target/X86/X86FloatingPoint.cpp b/lib/Target/X86/X86FloatingPoint.cpp index 73144cb28f..af5bb7db33 100644 --- a/lib/Target/X86/X86FloatingPoint.cpp +++ b/lib/Target/X86/X86FloatingPoint.cpp @@ -281,7 +281,12 @@ namespace { unsigned from; unsigned to; bool operator<(const TableEntry &TE) const { return from < TE.from; } - bool operator<(unsigned V) const { return from < V; } + friend bool operator<(const TableEntry &TE, unsigned V) { + return TE.from < V; + } + friend bool operator<(unsigned V, const TableEntry &TE) { + return V < TE.from; + } }; } |