<?xml version="1.0" encoding="windows-1252"?>
<node id="947380" title="Re^2: emulate 32-bit on perl 64" created="2012-01-11 11:55:12" updated="2012-01-11 11:55:12">
<type id="11">
note</type>
<author id="888573">
Eliya</author>
<data>
<field name="doctext">
&lt;blockquote&gt;
&lt;i&gt; As long as you are very careful to use unsigned arithmetic and specify bitmasks that are no larger than the integer-size you know that you are using, code like this ought to be transportable. &lt;/i&gt;
&lt;/blockquote&gt;
&lt;p&gt; Unfortunately, it's not always quite as simple in the general case.&amp;nbsp; For example, if the 32-bit code relies on specific overflow/wrap-over effects. Consider the following very simple case: &lt;/p&gt;
&lt;c&gt;
my $result = (0xffffffff + 2) &amp; 0xffffffff;
print $result;
&lt;/c&gt;
&lt;p&gt; Although the result is masked down to 32 bits, it differs depending on the perl being used: &lt;/p&gt;
&lt;c&gt;
32-bit perl: 4294967295
64-bit perl: 1
&lt;/c&gt;
&lt;p&gt; (I'm not saying it cannot be done, but it requires taking into account the specific overflow behavior, IV/UV to NV conversions of 32-bit perls, etc. &amp;#8212; simple &lt;c&gt;0xffffffff&lt;/c&gt; AND-masking isn't enough.) &lt;/p&gt;</field>
<field name="root_node">
947353</field>
<field name="parent_node">
947373</field>
</data>
</node>
