<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Hi Nicolas,<br>
      <br>
      Am 15.04.2013 19:22, schrieb Nicolas Cellier:<br>
    </div>
    <blockquote
cite="mid:CAKnRiT6UvY_KB8KkkQqTkxEsUdwAuRbyW7WQ4=Qx4_1_by8W+Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>If you look at the terminal instructions in
              primitiveBitShift you'll see:<br>
              <br>
              &nbsp;&nbsp;&nbsp; self push: (self positive32BitIntegerFor: shifted)<br>
              <br>
            </div>
            If you inquire a bit, you will see that
            positive32BitIntegerFor: will create a LargePositiveInteger
            instead of failing the primitive.<br>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    ok, i have assumed, that "positive32BitIntegerFor" will return a
    small integer because of "32 bit" in its name :-)<br>
    well, it does return a 32 bit integer but if to big for small
    integer, a largePositiveInteger gets built...<br>
    <br>
    <blockquote
cite="mid:CAKnRiT6UvY_KB8KkkQqTkxEsUdwAuRbyW7WQ4=Qx4_1_by8W+Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
          </div>
          The balance between purity and efficiency I guess...<br>
          <br>
        </div>
      </div>
    </blockquote>
    <br>
    this makes sense!<br>
    thank you!<br>
    <br>
    <blockquote
cite="mid:CAKnRiT6UvY_KB8KkkQqTkxEsUdwAuRbyW7WQ4=Qx4_1_by8W+Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">Nicolas<br>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">2013/4/15 Helmut Rohregger <span
            dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:helmut.rohregger@gmail.com" target="_blank">helmut.rohregger@gmail.com</a>&gt;</span><br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
            Am 15.04.2013 11:55, schrieb Igor Stasenko:
            <div>
              <div class="h5"><br>
                <blockquote class="gmail_quote" style="margin:0 0 0
                  .8ex;border-left:1px #ccc solid;padding-left:1ex">
                  &nbsp; On 15 April 2013 11:46, Helmut Rohregger &lt;<a
                    moz-do-not-send="true"
                    href="mailto:helmut.rohregger@gmail.com"
                    target="_blank">helmut.rohregger@gmail.com</a>&gt;
                  wrote:<br>
                  <blockquote class="gmail_quote" style="margin:0 0 0
                    .8ex;border-left:1px #ccc solid;padding-left:1ex">
                    Am 15.04.2013 11:40, schrieb Igor Stasenko:<br>
                    <br>
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      &nbsp; &nbsp;On 15 April 2013 11:31, Helmut Rohregger &lt;<a
                        moz-do-not-send="true"
                        href="mailto:helmut.rohregger@gmail.com"
                        target="_blank">helmut.rohregger@gmail.com</a>&gt;<br>
                      wrote:<br>
                      <blockquote class="gmail_quote" style="margin:0 0
                        0 .8ex;border-left:1px #ccc
                        solid;padding-left:1ex">
                        Hi all,<br>
                        <br>
                        i am interested in the implementations of
                        primitives in the VMMaker<br>
                        package<br>
                        and found some code, which i think may be
                        implemented incorrectly.<br>
                        Maybe some of you can help me out and correct me
                        if i am wrong.<br>
                        <br>
                        Its located in InterpreterPrimitives&gt;&gt;#primitiveBitShift<br>
                        (VMMaker-dtl.319):<br>
                        the code: "self success: integerArgument &lt;=
                        31" checks, if we lose bits<br>
                        by<br>
                        shifting to the left. This is because of
                        processing SmallIntegers here,<br>
                        isn't it? But a "1 bitShift: 31" will produce a
                        LargePositiveInteger<br>
                        instead<br>
                        of a SmallInteger. In fact a left shift of 30
                        will produce a<br>
                        LargePositiveInteger too.<br>
                        <br>
                        I know the code works, because the resulting
                        object gets checked being a<br>
                        SmallInteger and fails if not. But the correct
                        check would be "self<br>
                        success:<br>
                        integerArgument &lt;= 29", isn't it?<br>
                        What do you think?<br>
                        <br>
                      </blockquote>
                      hmm., how do you know if shifted result will fit
                      into smallint, if you<br>
                      don't check both operands?<br>
                      <br>
                      "1 &lt;&lt; 29 " fits<br>
                      "SmallInteger maxVal &lt;&lt; 29 " doesnt.<br>
                      even<br>
                      "SmallInteger maxVal &lt;&lt; 1 " doesnt.<br>
                    </blockquote>
                    <br>
                    but " x &lt;&lt; 30 " does never fit, no matter
                    which value 'x' has.<br>
                  </blockquote>
                  0 &lt;&lt; 30 = 0.<br>
                  fits.<br>
                  <br>
                  <br>
                </blockquote>
              </div>
            </div>
            hehe i know.<br>
            and "0 &lt;&lt; SmallInteger maxVal" fits too, but will fail
            with the implemented primitive.<br>
            <br>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>