Uploaded image for project: 'Terrier Core'
  1. Terrier Core
  2. TR-336

readMinimalBinary in BitInBase.java does not match with its writeMinimalBinary counterpart

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.1
    • Component/s: .compression
    • Labels:
      None

      Description

      The original code (in comment) does not work properly. Next line after each comment fixes this (at least in my experiments):

          public int readMinimalBinary(final int b) throws IOException {
              final int log2b = BitUtilities.mostSignificantBit(b);
              final int m = (1 << log2b + 1) - b;
              final int x = readBinary(log2b);
              if (x < m) {
      // return x + 1;
                  return x;
              } else {
      // int temp = (x << 1) + readBinary(1);
                  int temp = (x << 1) + readBinary(1) - m;
                  return temp;
              }
          }

        Attachments

          Activity

          saulvargas Saúl Vargas created issue -
          saulvargas Saúl Vargas made changes -
          Field Original Value New Value
          Attachment TestCompressedBitFilesGolomb.java [ 10435 ]
          craigm Craig Macdonald made changes -
          Fix Version/s 4.1 [ 10070 ]
          saulvargas Saúl Vargas made changes -
          craigm Craig Macdonald made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]

            People

            • Assignee:
              craigm Craig Macdonald
              Reporter:
              saulvargas Saúl Vargas
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: