On Sun, Feb 28, 2010 at 8:58 PM, Eli Friedman <eli.friedman at gmail.com> wrote:> In terms of correctness, it should work except for the fact that the > LLVM code generators don't implement more complicated operations on > such integers, like multiplication, division, and variable-width > shifts. The issues with returning large integers are fixed, at least > on x86.But not on other platforms? What's the largest integer such that something like 'return ((a * b) / c) >> d' works correctly on all major platforms?
On Sun, Feb 28, 2010 at 1:02 PM, Russell Wallace <russell.wallace at gmail.com> wrote:> On Sun, Feb 28, 2010 at 8:58 PM, Eli Friedman <eli.friedman at gmail.com> wrote: >> In terms of correctness, it should work except for the fact that the >> LLVM code generators don't implement more complicated operations on >> such integers, like multiplication, division, and variable-width >> shifts. The issues with returning large integers are fixed, at least >> on x86. > > But not on other platforms?If I recall correctly, there was some platform-specific work involved, and I'm not sure it got done on all platforms.> What's the largest integer such that something like 'return ((a * b) / > c) >> d' works correctly on all major platforms?Twice the size of a pointer, i.e. 64 bits on 32-bit platforms and 128 bits on 64-bit platforms. -Eli
On Sun, Feb 28, 2010 at 9:07 PM, Eli Friedman <eli.friedman at gmail.com> wrote:> On Sun, Feb 28, 2010 at 1:02 PM, Russell Wallace > <russell.wallace at gmail.com> wrote: >> What's the largest integer such that something like 'return ((a * b) / >> c) >> d' works correctly on all major platforms? > > Twice the size of a pointer, i.e. 64 bits on 32-bit platforms and 128 > bits on 64-bit platforms.Okay, thanks. Do I understand correctly that this is likely to continue to be the case, so language support for large integers will need to be implemented by other means?