<html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  </head>
  <body>
    <p>Hey ya, Levente,</p>
    <p>Woot!!! I was able to get all the primitives working with
      ByteArrays. Everything is passing green! (except for several GF
      fields: Aztec and Maxicode and QRCode) I think I will primitize
      one of the codingLoops on the RSErasure side. Here are the
      numbers.  Take note of the tallies and time: 50 seconds versus 114
      seconds.<br/>
      <br/>
      I updated the squeak wiki Cryptography page
      (<a class="moz-txt-link-freetext" href="http://wiki.squeak.org/squeak/5776">http://wiki.squeak.org/squeak/5776</a>) with d/l links to the
      plugins. Here are those links:</p>
    <p>[1] RSErasurePlugin - <a class="external" href="https://www.dropbox.com/s/kog96d3pqentket/RSErasurePlugin.so?dl=1">https://www.dropbox.com/s/kog96d3pqentket/RSErasurePlugin.so?dl=1</a><br/>
      [2] RSFECPlugin - <a class="external" href="https://www.dropbox.com/s/a1vvihi7o2fqtkj/RSFECPlugin.so?dl=1">https://www.dropbox.com/s/a1vvihi7o2fqtkj/RSFECPlugin.so?dl=1</a><br/>
    </p>
    <p>Thanks so much for your help! You are an angel!<br/>
      Robert<br/>
    </p>
    <blockquote>
      <p>WITH PLUGINS<br/>
        <br/>
         - 49238 tallies, 50468 msec.<br/>
        <br/>
        **Leaves**<br/>
        13.0% {6580ms} RSFECDecoder>>decode:twoS:<br/>
        7.8% {3931ms}
        RSErasureGaloisWithPlugin>>galoisMultiply:by:<br/>
        6.8% {3450ms} RSErasureGaloisWithPlugin>>addOrSubtract:by:<br/>
        6.1% {3063ms} RSErasureGaloisWithPlugin>>maskValue:<br/>
        6.1% {3053ms} RSFECGenericGFPoly
        class>>newField:coefficients:<br/>
        4.0% {2032ms} RSFECDecoder>>findErrorLocations:<br/>
        2.4% {1197ms} RSErasureGaloisWithPlugin>>tableMultiply:by:<br/>
        1.8% {917ms} RSFECGenericGFWithPlugin>>multiply:by:<br/>
        1.7% {877ms} []
RSErasureOutputByteInputExpCodingLoop>>codeSomeShardsGalois:matrixRow...:outputCount:offset:byteCount:<br/>
        1.6% {823ms}
        RSErasureGaloisWithPlugin>>normalizeInImageIndex:<br/>
        1.2% {609ms}
        RSFECDecoder>>findErrorMagnitudes:errorLlocations:</p>
    </blockquote>
    <p>And:</p>
    <blockquote>
      <p>WITHOUT PLUGINS<br/>
        <br/>
         - 112019 tallies, 114572 msec.<br/>
         <br/>
        **Leaves**<br/>
        20.2% {23095ms} RSFECGenericGF>>exp:<br/>
        12.0% {13745ms} RSFECGenericGF>>addOrSubtract:by:<br/>
        10.8% {12381ms} RSFECGenericGF>>maskValue:<br/>
        7.8% {8910ms} RSFECGenericGF>>log:<br/>
        7.6% {8655ms} RSFECGenericGF>>normalizeIndex:<br/>
        6.0% {6931ms} RSFECGenericGF>>multiply:by:<br/>
        3.1% {3508ms} RSFECGenericGFPoly>>evaluateAt:<br/>
        2.8% {3190ms} RSErasureGalois>>maskValue:<br/>
        1.9% {2182ms} RSErasureGalois>>normalizeIndex:<br/>
        1.8% {2009ms} RSFECGenericGFPoly>>addOrSubtractPoly:<br/>
        1.7% {2003ms}
        RSFECGenericGFPoly>>multiplyByMonomialDegree:coefficient:<br/>
        1.4% {1564ms} RSErasureGalois>>log:<br/>
        1.3% {1522ms} RSErasureGalois>>galoisMultiply:by:<br/>
        1.2% {1350ms} RSErasureGalois>>exp:<br/>
        1.1% {1308ms}
        RSErasureGaloisTest(TestCase)>>assert:description:<br/>
        <br/>
      </p>
    </blockquote>
    <div class="moz-signature">---<br/>
      Kindly,<br/>
      Robert<br/>
      <br/>
      <br/>
    </div>
    <div class="moz-cite-prefix">On 5/31/21 8:27 PM, Robert Withers
      wrote:<br/>
    </div>
    <blockquote type="cite" cite="mid:b68af2ae-45bc-b48b-f9cb-ec53e337143c@pm.me">
      <pre class="moz-quote-pre" wrap="">Awesome, Levente! My bad. Thanks so much! So glad you were able to clear
it up. I will make the appropriate changes. As the field size is max
256: { 0-255 }, perhaps using ByteArrays everywhere would be better. I
should make sure ParrotTalk uses them as well. In 64-bit VMs are
"unsigned ints" 64 bits? Thus the DoubleWordArray?

---
Kindly,
Robert


On 5/31/21 8:05 PM, Levente Uzonyi wrote:
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">Hi Robert,

After a quick look, the problem seems to be that you're reading the first
parameter, selfCoefficientsOop with #stackIntegerValue:, but the parameter
is an array, not an integer, so it needs to be read with #stackObjectValue:.
I don't think #stSizeOf: does any good when its argument is an integer
oop, hence the crash.

For simplicity and efficiency, I suggest you should pass a WordArray to
the primtive (and use WordArrays in the image as well). It maps to the
unsigned ints the primitive uses, and you can use #firstIndexableField:
safely.
Passing an Array would complicate things, as an Array can hold any kind of
objects (which the primitive would have to check before using them), and
its field size doesn't fit into an unsigned int on 64-bits.

Also, validation of the arguments should be strict in the primitive. Have
a look at e.g. DESPlugin >> #primitiveDESTransform to see how it validates
its two arguments, a ByteArray and a WordArray.


Levente

P.S.: If the coefficients fit into smaller fields, it's worth to use a
ByteArray or a DoubleByteArray instead of a WordArray for better
performance.
</pre>
      </blockquote>
    </blockquote>


</body></html>