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

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.8.0-rc0
    • Fix Version/s: 2.8.0-rc1
    • Component/s: Concurrency
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      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

            Assignee:
            geert.bosch Geert Bosch
            Reporter:
            schwerin Andy Schwerin
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: