<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p>Filed <a class="moz-txt-link-freetext" href="https://bugs.openjdk.org/browse/JDK-8297731">https://bugs.openjdk.org/browse/JDK-8297731</a>.</p>
    <p>Thanks,</p>
    <p>-Joe<br>
    </p>
    <div class="moz-cite-prefix">On 11/28/2022 4:35 AM, Raffaello
      Giulietti wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:BY5PR10MB4002B37473637965A2AB37C687139@BY5PR10MB4002.namprd10.prod.outlook.com">
      
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style>@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:10.0pt;
        font-family:"Calibri",sans-serif;}a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}div.WordSection1
        {page:WordSection1;}</style>
      <div class="WordSection1">
        <p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US" lang="EN-US">I can confirm that testing that condition is
            indeed useless<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US" lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
        <div style="border:none;border-top:solid #B5C4DF
          1.0pt;padding:3.0pt 0cm 0cm 0cm">
          <p class="MsoNormal" style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">core-libs-dev
              <a class="moz-txt-link-rfc2396E" href="mailto:core-libs-dev-retn@openjdk.org"><core-libs-dev-retn@openjdk.org></a> on behalf of Andrey
              Turbanov <a class="moz-txt-link-rfc2396E" href="mailto:turbanoff@gmail.com"><turbanoff@gmail.com></a><br>
              <b>Date: </b>Friday, 2022-November-25 at 14:18<br>
              <b>To: </b>core-libs-dev
              <a class="moz-txt-link-rfc2396E" href="mailto:core-libs-dev@openjdk.java.net"><core-libs-dev@openjdk.java.net></a><br>
              <b>Subject: </b>Redundant condition in
              java.math.MutableBigInteger#divideMagnitude<o:p></o:p></span></p>
        </div>
        <div>
          <p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt">Hello.<br>
              I noticed that IntelliJ IDEA show warning in the method<br>
              java.math.MutableBigInteger#divideMagnitude<br>
              here - <a href="https://github.com/openjdk/jdk/blob/4f65570204e2d38415e7761bd81660b081eae882/src/java.base/share/classes/java/math/MutableBigInteger.java#L1536" moz-do-not-send="true" class="moz-txt-link-freetext">
https://github.com/openjdk/jdk/blob/4f65570204e2d38415e7761bd81660b081eae882/src/java.base/share/classes/java/math/MutableBigInteger.java#L1536</a><br>
              It seems that condition is always 'true'<br>
              <br>
                 if (rem.intLen == nlen) {<br>
              <br>
              'rem' and 'nlen' variables are not changed anyhow after
              this<br>
              assignment a few lines above:<br>
              <br>
                  int nlen = rem.intLen;<br>
              <br>
              To make sure that it's really true, I've modified source
              to include else branch:<br>
              <br>
              } else {<br>
                  throw new AssertionError("Condition 'rem.intLen ==
              nlen' wasn't met.");<br>
              }<br>
              <br>
              And all tests from "jdk/java/math" passed.<br>
              <br>
              <br>
              Can we clean up the code to remove this condition? Code is
              already<br>
              complex enough and each condition makes its reading
              harder.<br>
              It was added as part of performance improvements in<br>
              <a href="https://bugs.openjdk.org/browse/JDK-7082971" moz-do-not-send="true" class="moz-txt-link-freetext">https://bugs.openjdk.org/browse/JDK-7082971</a><br>
              <br>
              <br>
              Andrey Turbanov<o:p></o:p></span></p>
        </div>
      </div>
    </blockquote>
  </body>
</html>