<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 09/09/2013 07:38 PM, Juan Jose Comellas wrote:
    <blockquote
cite="mid:CAOLqyqwL232qHKE4LvBQU6f=HTDrndjSPuaMOWd1fPbH3t7g1A@mail.gmail.com"
      type="cite">
      <div dir="ltr">Sorry, there was a mistake in the commit message
        for the fix I had previously sent. I've canceled the original
        pull request and created a new one. The correct branch is in:
        <div><br>
        </div>
        <div>
          <div>git fetch git://<a moz-do-not-send="true"
              href="http://github.com/jcomellas/otp.git">github.com/jcomellas/otp.git</a>
            jc-integer-to-binary2_1</div>
          <div><br>
          </div>
          <a moz-do-not-send="true"
href="https://github.com/jcomellas/otp/compare/erlang:maint...jc-integer-to-binary2_1">https://github.com/jcomellas/otp/compare/erlang:maint...jc-integer-to-binary2_1</a><br>
          <a moz-do-not-send="true"
href="https://github.com/jcomellas/otp/compare/erlang:maint...jc-integer-to-binary2_1.patch">https://github.com/jcomellas/otp/compare/erlang:maint...jc-integer-to-binary2_1.patch</a></div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On Mon, Sep 9, 2013 at 2:23 PM, Juan
          Jose Comellas <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:juanjo@comellas.org" target="_blank">juanjo@comellas.org</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">
              <div>The <font face="courier new, monospace">integer_to_binary/2</font> function works
                perfectly with base 10 (because it just calls <font
                  face="courier new, monospace">integer_to_binary/1</font>),
                but when used with other bases it fails when 0 or a
                negative number are passed as the number to convert.
                e.g.:</div>
              <div><br>
              </div>
              <div>
                <div><font face="courier new, monospace">1>
                    integer_to_binary(0, 16).</font></div>
                <div><font face="courier new, monospace"><<>></font></div>
                <div><font face="courier new, monospace"><br>
                  </font></div>
                <div><font face="courier new, monospace">2>
                    integer_to_binary(-1, 16).</font></div>
                <div><font face="courier new, monospace">** exception
                    error: bad argument</font></div>
                <div><font face="courier new, monospace">     in
                    function  byte_size/1</font></div>
                <div><font face="courier new, monospace">        called
                    as byte_size([])</font></div>
                <div><font face="courier new, monospace">     in call
                    from erlang:integer_to_binary/3 </font></div>
                <div><font face="courier new, monospace">     in call
                    from integer_to_binary/2</font></div>
              </div>
              <div><br>
              </div>
              <div>The expected results are:</div>
              <div><br>
              </div>
              <div>
                <div><font face="courier new, monospace">1>
                    integer_to_binary(0, 16).</font></div>
                <div><font face="courier new, monospace"><<"0">></font></div>
              </div>
              <div><font face="courier new, monospace"><br>
                </font></div>
              <div>
                <div><font face="courier new, monospace">2>
                    integer_to_binary(-1, 16).</font></div>
              </div>
              <div>
                <div><font face="courier new, monospace"><<"-1">></font></div>
                <div><br>
                </div>
                <div>I've sent this change as a pull request, but on
                  this branch there's the patch to fix this problem and
                  some tests to cover these cases.</div>
              </div>
              <div><br>
              </div>
              <div>git fetch git://<a moz-do-not-send="true"
                  href="http://github.com/jcomellas/otp.git"
                  target="_blank">github.com/jcomellas/otp.git</a>
                jc-integer_to_binary2</div>
              <div><br>
              </div>
              <div><a moz-do-not-send="true"
href="https://github.com/jcomellas/otp/compare/erlang:maint...jc-integer_to_binary2"
                  target="_blank">https://github.com/jcomellas/otp/compare/erlang:maint...jc-integer_to_binary2</a></div>
              <div><a moz-do-not-send="true"
href="https://github.com/jcomellas/otp/compare/erlang:maint...jc-integer_to_binary2.patch"
                  target="_blank">https://github.com/jcomellas/otp/compare/erlang:maint...jc-integer_to_binary2.patch</a></div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
erlang-patches mailing list
<a class="moz-txt-link-abbreviated" href="mailto:erlang-patches@erlang.org">erlang-patches@erlang.org</a>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-patches">http://erlang.org/mailman/listinfo/erlang-patches</a>
</pre>
    </blockquote>
    Hello,<br>
    The patch will be running in the nightly builds and tests.<br>
    Thanks for contributing,<br>
    <br>
    <pre class="moz-signature" cols="72">-- 

BR Fredrik Gustafsson
Erlang OTP Team</pre>
  </body>
</html>