dict: Remove guard for past-the-end iterators that might mask problems in static...
authorAlberto Gonzalez <boqwxp@airmail.cc>
Fri, 19 Jun 2020 20:57:27 +0000 (20:57 +0000)
committerAlberto Gonzalez <boqwxp@airmail.cc>
Fri, 19 Jun 2020 21:04:29 +0000 (21:04 +0000)
Co-Authored-By: whitequark <whitequark@whitequark.org>
kernel/hashlib.h

index 52dfd12803d2403a78926aef7b59913cf3614fa8..a523afadd080db4ddfb6d0e3558252bf1cab068f 100644 (file)
@@ -363,7 +363,7 @@ public:
        public:
                const_iterator() { }
                const_iterator operator++() { index--; return *this; }
-               const_iterator operator+=(int amt) { index -= amt; if(index < 0) index = -1; return *this; }
+               const_iterator operator+=(int amt) { index -= amt; return *this; }
                bool operator<(const const_iterator &other) const { return index > other.index; }
                bool operator==(const const_iterator &other) const { return index == other.index; }
                bool operator!=(const const_iterator &other) const { return index != other.index; }
@@ -381,7 +381,7 @@ public:
        public:
                iterator() { }
                iterator operator++() { index--; return *this; }
-               iterator operator+=(int amt) { index -= amt; if(index < 0) index = -1; return *this; }
+               iterator operator+=(int amt) { index -= amt; return *this; }
                bool operator<(const iterator &other) const { return index > other.index; }
                bool operator==(const iterator &other) const { return index == other.index; }
                bool operator!=(const iterator &other) const { return index != other.index; }