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

ZigZag encoder/decoder for signed 32bit and 64bit integer

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.1.0
    • Component/s: None
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Sprint:
      Execution Team 2021-06-28, Execution Team 2021-07-12
    • Linked BF Score:
      0

      Description

      Add a "ZigZag" encoder for signed integers that stores the sign bit as the least significant bit. Two's complement is using the most significant bit resulting in a large bit difference for -1 vs 0.

      With ZigZag, Simple-8b encoder does then not have to know about signed integers and can treat everything as unsigned.

      For 32bit integers ZigZag encoding would look like this:
      zigzag = (n << 1) ^ (n >> 31)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              luke.bhan Luke Bhan (Inactive)
              Reporter:
              jackson.xie Jackson Xie (Inactive)
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: