Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-134690

qHashMulti and qHashMultiCommutative use the slower seed==0 algorithms for strings

    XMLWordPrintable

Details

    • eb1342a3c (dev), db36fea29 (6.9), 1a580ca2a (dev)

    Description

      The implementations of qHashMulti() and qHashMultiCommutative() are implemented using calls to qHash() without a seed parameter:

          constexpr result_type operator()(size_t seed, const T &t) const noexcept(noexcept(qHash(t)))
          // combiner taken from N3876 / boost::hash_combine
          { return seed ^ (qHash(t) + 0x9e3779b9 + (seed << 6) + (seed >> 2)) ; }
      ...
          constexpr result_type operator()(size_t seed, const T &t) const noexcept(noexcept(qHash(t)))
          { return seed + qHash(t); } // don't use xor!
      

      This results in using the slower implementation of qHashBits() for all of our string classes.

      I don't know if qHashMultiCommutative() is fixable, but qHashMulti() definitely is.

      Requires BC break to fix.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-134690
          # Subject Branch Project Status CR V

          Activity

            People

              cnn Qt Core & Network
              thiago Thiago Macieira
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: