<html><head></head><body> <div>Hi Eliot, I hope all is well with you! </div><div><br></div><div>I will try to make these changes, both in my working primitives and in my 7 broken primitives. See if that might help.</div><div><br></div>Grazie Mille!<caret></caret><br><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 Sat, Jun 5, 2021 at 19:39, Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com" class="">eliot.miranda@gmail.com</a>> wrote:<blockquote class="protonmail_quote" type="cite"> Hi Robert,<br><br>_,,,^..^,,,_ (phone)<br><br>> On Jun 4, 2021, at 11:52 AM, Robert Withers <robert.withers@pm.me> wrote:<br>><br>> fieldSize := interpreterProxy stackIntegerValue: 1.<br>> coefficientsOop := interpreterProxy stackObjectValue: 0.<br><br>Since you check for isBytes: below you can use stackValue:. isBytes: can safely be passed any object, including immediates. So the stackObjectValue: call implies a redundant validation.<br><br>><br>> (interpreterProxy isIntegerValue: fieldSize)<br>> ifFalse: [ ^interpreterProxy primitiveFailFor: PrimErrBadArgument ].<br><br>This is implicit. stackIntegerValue: fails if the object is not a SmallInteger (retiring zero) and otherwise answers its integerValue. So you should check if stackIntegerValue: fails since its return value will always answer true to isIntegerValue:<br><br>> (interpreterProxy isBytes: coefficientsOop)<br>> ifFalse: [ ^interpreterProxy primitiveFailFor: PrimErrBadArgument ].<br><br>I would write<br><br>fieldSize := interpreterProxy stackIntegerValue: 1.<br> coefficientsOop := interpreterProxy stackValue: 0.<br><br> (interpreterProxy failed not<br> and: [interpreterProxy isBytes: coefficientsOop])<br> ifFalse: [ ^interpreterProxy primitiveFailFor: PrimErrBadArgument ].<br><br>or<br><br>fieldSizeOop := interpreterProxy stackValue: 1.<br> coefficientsOop := interpreterProxy stackValue: 0.<br><br> ((interpreterProxy isIntegerObject: fieldSizeOop)<br> and: [interpreterProxy isBytes: coefficientsOop])<br> ifFalse: [ ^interpreterProxy primitiveFailFor: PrimErrBadArgument ].<br><br> fieldSize := interpreterProxy integerValueOf: fieldSizeOop.<br><br></blockquote><div><br></div><div><br></div></body></html>