<html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  </head>
  <body>
    <p>Hi Levente,</p>
    <p>I hope you are having a great day! Are you in Budapest? That must
      be awesome! A very old city.</p>
    <p>I thought I would post the Squeak code for this instantiatePoly
      primitive. My image still blows up on startUp:. I am grateful you
      have guided me through this!<br/>
    </p>
    <blockquote>
      <p>primitiveInitializePolyFieldSizeCoefficients<br/>
        <br/>
            <export: true><br/>
            <var: 'coefficients' type: 'unsigned char*' ><br/>
        <br/>
            | coefficients count coefficientsOop fieldSize result |<br/>
            interpreterProxy methodArgumentCount = 2<br/>
                ifFalse: [ ^interpreterProxy primitiveFailFor:
        PrimErrBadNumArgs ].<br/>
            fieldSize := interpreterProxy stackIntegerValue: 1.<br/>
            coefficientsOop := interpreterProxy stackObjectValue: 0.<br/>
        <br/>
            (interpreterProxy isIntegerValue: fieldSize)<br/>
                ifFalse: [ ^interpreterProxy primitiveFailFor:
        PrimErrBadArgument ].<br/>
            (interpreterProxy isBytes: coefficientsOop) <br/>
                ifFalse: [ ^interpreterProxy primitiveFailFor:
        PrimErrBadArgument ].<br/>
            count := interpreterProxy stSizeOf: coefficientsOop.<br/>
            coefficients := interpreterProxy firstIndexableField:
        coefficientsOop.<br/>
        <br/>
            (count = 0)<br/>
                ifTrue: [ ^interpreterProxy primitiveFailFor:
        PrimErrBadArgument ].<br/>
        <br/>
            result := self <br/>
                initializePolyFieldSize: fieldSize <br/>
                coefficients: coefficients <br/>
                coefficientsCount: count.<br/>
        <br/>
            ^ interpreterProxy failed<br/>
                    ifTrue: [interpreterProxy primitiveFail]<br/>
                    ifFalse: [interpreterProxy methodReturnValue:
        result].</p>
    </blockquote>
    <p>Which is calling:</p>
    <blockquote>
      <p>initializePolyFieldSize: fieldSize coefficients: coefficients
        coefficientsCount: coefficientsCount<br/>
        <br/>
            <var: 'coefficients' type: #'unsigned char*'><br/>
        <br/>
            | coefficientsLength firstNonZero mutableCoefficients |<br/>
            mutableCoefficients := coefficients.<br/>
            coefficientsLength := coefficientsCount.<br/>
            ((coefficientsLength > 1) & ((coefficients at: 1) =
        0))<br/>
                ifTrue: [<br/>
                    firstNonZero := 2.<br/>
                    [(firstNonZero <= coefficientsLength) and:
        [(mutableCoefficients at: firstNonZero) = 0]]<br/>
                        whileTrue: [firstNonZero := firstNonZero + 1].<br/>
                    (firstNonZero > coefficientsLength)<br/>
                        ifTrue: [<br/>
                                mutableCoefficients := interpreterProxy<br/>
                                    instantiateClass: interpreterProxy
        classByteArray<br/>
                                    indexableSize: 1]<br/>
                        ifFalse: [<br/>
                                mutableCoefficients := interpreterProxy<br/>
                                    instantiateClass: interpreterProxy
        classByteArray<br/>
                                    indexableSize: (coefficientsLength -
        firstNonZero + 1).<br/>
                                0 to: (coefficientsLength - 1)<br/>
                                    do: [:index |<br/>
                                        coefficients at: index put:
        (mutableCoefficients at: index)]]].<br/>
            ^ mutableCoefficients.</p>
    </blockquote>
    <p><br/>
    </p>
    <div class="moz-signature">---<br/>
      K<span class="Y2IQFc" lang="hu">öszönöm</span>,<br/>
      Robert<br/>
      <br/>
      <br/>
    </div>
    <div class="moz-cite-prefix">On 6/4/21 1:38 PM, Robert Withers
      wrote:<br/>
    </div>
    <blockquote type="cite" cite="mid:7fcbbbac-f85c-f8e7-7c48-728bb3142495@pm.me">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
      <p>I am getting this warning when cross compiling the Squeak
        plugin to C code.</p>
      <blockquote>
        <p>warning, signature of
          InterpreterProxy>>instantiateClass:indexableSize: does
          not match reference implementation.<br/>
        </p>
      </blockquote>
      <div class="moz-signature">---<br/>
        Kindly,<br/>
        Robert<br/>
        <br/>
        <br/>
      </div>
      <div class="moz-cite-prefix">On 6/4/21 1:21 PM, Robert Withers
        wrote:<br/>
      </div>
      <blockquote type="cite" cite="mid:efd9382f-edae-5651-b786-1c8d7c53c375@pm.me">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <p>Nope, this wasn't it.<br/>
        </p>
        <div class="moz-signature">---<br/>
          Kindly,<br/>
          Robert<br/>
          <br/>
          <br/>
        </div>
        <div class="moz-cite-prefix">On 6/4/21 12:36 PM, Robert wrote:<br/>
        </div>
        <blockquote type="cite" cite="mid:n23wnbUwGw2wMIxOOu-mPD8niO5UREKvqUkPrAe9NRseu1S4Ld208KPpZE1ljmxwbiWxMp476bGrC3lMvRYK5g==@protonmail.internalid">
          <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
          <div>Oh! Heading for a coffee with my nurse. I realized I may
            be passing the field into the primitive instead of the field
            size. I’ll check it when I get back home!<caret></caret></div>
          <div><br/>
          </div>
          <div id="protonmail_signature_block" class="protonmail_signature_block">
            <div>
              <div>Kindly,<br/>
                Robert<br/>
                . .. ... ‘...^,^ </div>
            </div>
          </div>
          <div><br/>
          </div>
          <div><br/>
          </div>
          On Fri, Jun 4, 2021 at 12:12, Robert Withers <<a href="mailto:robert.withers@pm.me" class="" moz-do-not-send="true">robert.withers@pm.me</a>> wrote:
          <blockquote class="protonmail_quote" type="cite">
            <blockquote> </blockquote>
            <pre class="lang-c s-code-block hljs"><code><span class="hljs-function">Oh! I forgot to relocate leaves that have already been plugganized. This leaves (heh) 3 possible plugganizations that all instantiate ByteArrays. Here, I fixed it.</span></code>
<code><span class="hljs-function"></span></code></pre>
            <blockquote>
              <pre class="lang-c s-code-block hljs"><code><span class="hljs-function">WITH GF & GFPOLY PRIMITIVES AND DECODER <span class="hljs-title">PRIMITIVES</span>
<span class="hljs-params">(<span class="hljs-number">3</span> asterix <span class="hljs-keyword">for</span> in-progress plugganization)

</span> - 22194 tallies, 22648 msec.

</span></code><code><span class="hljs-function">**Leaves**
29.1% </span>{<span class="hljs-number">6586</span>ms} RSFECDecoderWithPlugin>>decode:twoS:
<span class="hljs-number">14.7</span>% {<span class="hljs-number">3329</span>ms} RSFECGenericGFPoly <span class="hljs-class"><span class="hljs-keyword">class</span>></span>>newField:coefficients:
<span class="hljs-number">1.0</span>% {<span class="hljs-number">237</span>ms} RSFECDecoderWithPlugin>>runEuclideanAlgorithmPoly:poly:rDegrees:</code></pre>
            </blockquote>
            <pre class="lang-c s-code-block hljs"><code></code>Calls to plugganized GF/GFPoly methods, so I think these are as optimized as possible:</pre>
            <blockquote>
              <pre class="lang-c s-code-block hljs"><code><span class="hljs-number">7.3</span>% {<span class="hljs-number">1646</span>ms} RSFECDecoderWithPlugin>>primFindErrorLocationsDegree:coefficients:result:fieldSize:
<span class="hljs-number">2.9</span>% {<span class="hljs-number">654</span>ms} RSFECDecoderWithPlugin>>findErrorMagnitudes:errorLocations:
<span class="hljs-number"></span></code><code><span class="hljs-number">1.4</span>% {<span class="hljs-number">317</span>ms} RSFECGenericGFWithPlugin>><span class="hljs-built_in">log</span>:
</code></pre>
            </blockquote>
            <pre class="lang-c s-code-block hljs"><code> </code></pre>
            <div class="moz-signature">---<br/>
              Kindly,<br/>
              Robert<br/>
              <br/>
              <br/>
            </div>
            <div class="moz-cite-prefix">On 6/4/21 12:02 PM, Robert
              Withers wrote:<br/>
            </div>
            <blockquote type="cite">
              <blockquote>
                <pre class="lang-c s-code-block hljs"><code><span class="hljs-function">WITH GF & GFPOLY PRIMITIVES AND DECODER <span class="hljs-title">PRIMITIVES</span>
<span class="hljs-params">(<span class="hljs-number">3</span> asterix <span class="hljs-keyword">for</span> in-progress plugganization)

</span> - 22194 tallies, 22648 msec.

</span></code><code><span class="hljs-function">**Leaves**
29.1% </span>{<span class="hljs-number">6586</span>ms} RSFECDecoderWithPlugin>>decode:twoS:
<span class="hljs-number">14.7</span>% {<span class="hljs-number">3329</span>ms} RSFECGenericGFPoly <span class="hljs-class"><span class="hljs-keyword">class</span>></span>>newField:coefficients:
<span class="hljs-number">7.3</span>% {<span class="hljs-number">1646</span>ms} RSFECDecoderWithPlugin>>primFindErrorLocationsDegree:coefficients:result:fieldSize:
<span class="hljs-number">2.9</span>% {<span class="hljs-number">654</span>ms} RSFECDecoderWithPlugin>>findErrorMagnitudes:errorLocations:
<span class="hljs-number">1.0</span>% {<span class="hljs-number">237</span>ms} RSFECDecoderWithPlugin>>runEuclideanAlgorithmPoly:poly:rDegrees:</code></pre>
              </blockquote>
              <pre class="lang-c s-code-block hljs"><code></code>Calls to plugganized GF/GFPoly methods:</pre>
              <blockquote> <code><span class="hljs-number">1.4</span>%
                  {<span class="hljs-number">317</span>ms}
                  RSFECGenericGFWithPlugin>><span class="hljs-built_in">log</span>: </code></blockquote>
            </blockquote>
          </blockquote>
          <div><br/>
          </div>
          <div><br/>
          </div>
        </blockquote>
      </blockquote>
    </blockquote>


</body></html>