<html><head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
  </head>
  <body>
    <p>Below is some Java code, with a comment, from ZXing's ReedSolomon
      error correction. It points out a hotspot bug with a workaround.
      What would be the Squeak code to calculate the denominator? I'm
      guessing that this hotspot bug does not exist in Squeak. I tried
      this code and it fails:</p>
    <blockquote>
      <p>denominator = field <br/>
            multiply: denominator <br/>
            by: (field <br/>
                addOrSubtract: 1<br/>
                by: (field <br/>
                    multiply: (errorLocations at: j) <br/>
                    by: xiInverse)).</p>
    </blockquote>
    <p>Notice the commented out code in the first 2 lines of the java
      comment. The computation seems to revolve around</p>
    <blockquote>
      <p><b>field addOrSubtract: 1 by: term</b><br/>
      </p>
    </blockquote>
    <p>or <br/>
    </p>
    <blockquote>
      <p><b>(term & 0x1) == 0 ? term | 1 : term & ~1;</b></p>
    </blockquote>
    <p>Here is the Java code. <i>
      </i></p>
    <blockquote>
      <p>//denominator = field.multiply(denominator,<br/>
        //    GenericGF.addOrSubtract(1,
        field.multiply(errorLocations[j], xiInverse)));<br/>
        // Above should work but fails on some Apple and Linux JDKs due
        to a Hotspot bug.<br/>
        // Below is a funny-looking workaround from Steven Parkes<br/>
        <i>int term = field.multiply(errorLocations[j], xiInverse);</i><i><br/>
        </i><i>int termPlus1 = (term & 0x1) == 0 ? term | 1 : term
          & ~1;</i><i><br/>
        </i><i>denominator = field.multiply(denominator, termPlus1);</i></p>
    </blockquote>
    -- <br/>
    <div class="moz-signature">---<br/>
      Kindly,<br/>
      Robert<br/>
      <br/>
      <br/>
    </div>


</body></html>