Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-16096

ResourceId constructors use operator% where they should use operator& for bit masking

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 2.8.0-rc0
    • 2.8.0-rc1
    • Concurrency
    • None
    • Fully Compatible
    • ALL

    Description

      The ResourceId constructors hash a resource name and then compute that value modulo 0x1fffffffffffffffULL. The author almost certainly meant to mask off the high order 3 bits, which is achieved by taking the bitwise and (operator&) rather than the unsigned integer modulus (operator%). Since operator% with this constant requires integer division, it is computationally far more expensive than necessary, but it may not be affecting the correctness of operation.

      ResourceId should probably be rewritten entirely in terms of bit masking, instead of a mix of bit masking and narrow bit field structures.

      Attachments

        Activity

          People

            geert.bosch@mongodb.com Geert Bosch
            schwerin@mongodb.com Andy Schwerin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: