Bug 1247835 (part 0) - Minor comment and style tweaks in BinarySearch.h. r=luke.
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 23 Feb 2016 15:41:39 +1100
changeset 321979 bc5e02dcb4015e4c3ae674fcf68e8a53e935b6c7
parent 321978 8ae0fba610234292b64a86f62722767f151abc17
child 321980 d1a8a43006ec0b186429362e3cc241dacf39ae94
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs1247835
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1247835 (part 0) - Minor comment and style tweaks in BinarySearch.h. r=luke.
mfbt/BinarySearch.h
--- a/mfbt/BinarySearch.h
+++ b/mfbt/BinarySearch.h
@@ -26,37 +26,37 @@ namespace mozilla {
  *
  *   Vector<int> sortedInts = ...
  *
  *   size_t match;
  *   if (BinarySearch(sortedInts, 0, sortedInts.length(), 13, &match)) {
  *     printf("found 13 at %lu\n", match);
  *   }
  *
- * The BinarySearchIf() version behaves similar, but takes |aComparator|, a
+ * The BinarySearchIf() version behaves similarly, but takes |aComparator|, a
  * functor to compare the values with, instead of a value to find.
  * That functor should take one argument - the value to compare - and return an
  * |int| with the comparison result:
  *
  *   * 0, if the argument is equal to,
  *   * less than 0, if the argument is greater than,
  *   * greater than 0, if the argument is less than
  *
  * the value.
  *
  * Example:
  *
  *   struct Comparator {
- *     int operator()(int val) const {
- *       if (mTarget < val) return -1;
- *       if (mTarget > val) return 1;
+ *     int operator()(int aVal) const {
+ *       if (mTarget < aVal) { return -1; }
+ *       if (mTarget > aVal) { return 1; }
  *       return 0;
  *     }
- *     Comparator(int target) : mTarget(target) {}
-       const int mTarget;
+ *     explicit Comparator(int aTarget) : mTarget(aTarget) {}
+ *     const int mTarget;
  *   };
  *
  *   Vector<int> sortedInts = ...
  *
  *   size_t match;
  *   if (BinarySearchIf(sortedInts, 0, sortedInts.length(), Comparator(13), &match)) {
  *     printf("found 13 at %lu\n", match);
  *   }
@@ -101,22 +101,22 @@ template<class T>
 class BinarySearchDefaultComparator
 {
 public:
   explicit BinarySearchDefaultComparator(const T& aTarget)
     : mTarget(aTarget)
   {}
 
   template <class U>
-  int operator()(const U& val) const {
-    if (mTarget == val) {
+  int operator()(const U& aVal) const {
+    if (mTarget == aVal) {
       return 0;
     }
 
-    if (mTarget < val) {
+    if (mTarget < aVal) {
       return -1;
     }
 
     return 1;
   }
 
 private:
   const T& mTarget;