<br><br><div class="gmail_quote">On Wed, Sep 8, 2010 at 1:48 PM, John M McIntosh <span dir="ltr">&lt;<a href="mailto:johnmci@smalltalkconsulting.com">johnmci@smalltalkconsulting.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
 <br>Let me try that with the correct email address...<br>
<br>
Begin forwarded message:<br>
<br>
&gt; From: John M McIntosh &lt;<a href="mailto:johnmci@smalltalkconsulting.com">johnmci@smalltalkconsulting.com</a>&gt;<br>
&gt; Date: September 8, 2010 2:20:29 AM PDT<br>
&gt; To: Squeak VM Developers &lt;<a href="mailto:squeak-vmdev@lists.sourceforge.net">squeak-vmdev@lists.sourceforge.net</a>&gt;<br>
&gt; Subject: squeak 32bit clean, no? yes?<br>
&gt; Reply-To: <a href="mailto:johnmci@smalltalkconsulting.com">johnmci@smalltalkconsulting.com</a><br>
&gt;<br>
&gt; It&#39;s 2:05am I should be in bed but I&#39;m confused.<br>
&gt;<br>
&gt; given BaseHeaderSize is 4<br>
&gt; foo-&gt;newMethod is a usqInt  (unsigned)<br>
&gt;<br>
&gt; I see in a interp.c<br>
&gt; Automatically generated from Squeak on #(27 April 2009 5:35:31 pm)<br>
&gt;<br>
&gt; sqInt activateNewMethod(void) {<br>
&gt; register struct foo * foo = &amp;fum;<br>
&gt;    sqInt initialIP;<br>
&gt;    sqInt newContext;<br>
&gt;    sqInt where;<br>
&gt;    sqInt methodHeader;<br>
&gt;    sqInt tempCount;<br>
&gt;    sqInt i;<br>
&gt;    sqInt nilOop;<br>
&gt;    sqInt tmp;<br>
&gt;<br>
&gt;       methodHeader = longAt((foo-&gt;newMethod + BaseHeaderSize) + (HeaderIndex &lt;&lt; ShiftForWord));<br>
&gt;<br>
&gt;<br>
&gt; So that is a longAt: ( unsigned sqInt + 4)<br>
&gt;<br>
&gt; But in  the interp.c code I generated in July I have<br>
&gt;       methodPointer (a sqInt) =  foo-&gt;newMethod (a usqint)<br>
&gt;       then<br>
&gt;       methodHeader = longAt((methodPointer + (BASE_HEADER_SIZE)) + (HeaderIndex &lt;&lt; (SHIFT_FOR_WORD)));<br>
&gt;<br>
&gt; So that is a longAt: (sqInt + 4).<br>
&gt;<br>
&gt; Er so if  foo-&gt;newMethod is &gt; 0x7FFFFFFF  won&#39;t that +4 not do what we think it should do?<br>
&gt; Or should I go to bed now?<br></blockquote><div><br></div><div>Go to bed.  In C (and in modulo arithmetic in general) (unsigned)((signed)v + N) == (unsigned)v + N.  e.g. 0x80000000 + 4 is indeed (2^32 - 4) negated but that&#39;s also 0x80000004.  i.e. the largest unsigned value is (unsigned)-1, all ones, and so when adding a positive value to a negative signed quantity you end up with a larger unsigned quantity.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
&gt;<br>
&gt;<br>
&gt; /* Automatically generated from Squeak on 8 July 2010 12:32:36 pm<br>
&gt;   by VMMaker 4.2.6<br>
&gt; */<br>
&gt;<br>
&gt;<br>
&gt; sqInt activateNewMethod(void) {<br>
&gt; register struct foo * foo = &amp;fum;<br>
&gt;    sqInt tempCount;<br>
&gt;    sqInt nilOop;<br>
&gt;    sqInt where;<br>
&gt;    sqInt initialIP;<br>
&gt;    sqInt i;<br>
&gt;    sqInt newContext;<br>
&gt;    sqInt methodHeader;<br>
&gt;    sqInt methodPointer;<br>
&gt;    sqInt tmp;<br>
&gt;    sqInt activeCntx;<br>
&gt;    sqInt valuePointer;<br>
&gt;    sqInt valuePointer1;<br>
&gt;<br>
&gt;       /* begin headerOf: */<br>
&gt;       methodPointer = foo-&gt;newMethod;<br>
&gt;       methodHeader = longAt((methodPointer + (BASE_HEADER_SIZE)) + (HeaderIndex &lt;&lt; (SHIFT_FOR_WORD)));<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; ===========================================================================<br>
&gt; John M. McIntosh &lt;<a href="mailto:johnmci@smalltalkconsulting.com">johnmci@smalltalkconsulting.com</a>&gt;   Twitter:  squeaker68882<br>
&gt; Corporate Smalltalk Consulting Ltd.  <a href="http://www.smalltalkconsulting.com" target="_blank">http://www.smalltalkconsulting.com</a><br>
&gt; ===========================================================================<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
<br>
--<br>
===========================================================================<br>
John M. McIntosh &lt;<a href="mailto:johnmci@smalltalkconsulting.com">johnmci@smalltalkconsulting.com</a>&gt;   Twitter:  squeaker68882<br>
Corporate Smalltalk Consulting Ltd.  <a href="http://www.smalltalkconsulting.com" target="_blank">http://www.smalltalkconsulting.com</a><br>
===========================================================================<br>
<br>
<br>
<br>
<br>
<br></blockquote></div><br>