bug-sh-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

64-bit arithmetic patch to sh-utils-2.0 so expr(1) works with long long


From: Jonathan Leffler
Subject: 64-bit arithmetic patch to sh-utils-2.0 so expr(1) works with long long when available
Date: Fri, 1 Mar 2002 15:01:43 -0800 (PST)

Hi,

The standard expr(1) code in src/expr.c uses type 'int' to evaluate
integer expressions.  We needed it to be able to handle larger numbers
associated with the sizes of large files (bigger than 2 GB).

Since the configure scripts test for 'unsigned long long', I've modified
the code in expr.c to utilize that test and assume that if 'unsigned
long long' is available, then so too is 'long long', and the printf(3)
format to use is "%lld".  If unsigned long long is not available, then
the code explicitly uses 'long' and "%ld"; on a 64-bit platform, that
will most likely yield the same effect as using 'long long' on a 32-bit
platform.

I made basically trivial changes in lib/xalloc.h and src/sys2.h so that
the code compiles more nearly cleanly under GCC 3.0.4 on Solaris 7 with
the options '-Wall -Wmissing-prototypes -Wstrict-prototypes'.  I'm sure
that the changes in src/sys2.h are not complete - more default
prototypes could and should be provided.

I hope this patch helps.  Please let me know if you release a sh-utils
maintenance release with this patch (or something very similar) in
place.

Thanks for the code!

-- 
Jonathan Leffler                           #include <disclaimer.h>
STSM, Informix Database Engineering, IBM Data Management Solutions
Phone: +1 650-926-6921                          Tie-line: 630-6921
Email: address@hidden (RIP address@hidden)
Notes ID: Jonathan Leffler/Menlo Park/address@hidden
Guardian of DBD::Informix v1.00.PC2 -- http://dbi.perl.org
            *=*=*=*=*=* THE END IS NIGH! *=*=*=*=*=*
Please use address@hidden because address@hidden will
not work from 2002-07-01.  Expect slower responses from 2002-02-18
because email will be sent to Notes and I can't use Lotus Notes as
fast as Unix email.  One day, this signature will shrink!

Attachment: sh-utils-2.0-patch
Description: Patch to src/expr.c, src/sys2.h, lib/xalloc.h for sh-utils-2.0


reply via email to

[Prev in Thread] Current Thread [Next in Thread]