/bin/sh and 32-bit arithmetics [CORRECTED]
Juli Mallett
jmallett at FreeBSD.org
Sat Apr 19 18:50:29 PDT 2003
* De: Alex Semenyaka <alexs at ratmir.ru> [ Data: 2003-04-19 ]
[ Subjecte: Re: /bin/sh and 32-bit arithmetics [CORRECTED] ]
> ...ghmmm... sorry and sorry... and here the patch, it is pretty small:
At a cursory glance: You are using quad_t (barf) formats for what
is intmax_t, you really want to use %j<qual> not %q<qual>, and you
may be doing more work than is necessary. Simply switching to
"long" in place of "int" for everything (and LONG_ vs INT_) may be
a better start than using intmax_t? intmax_t may be very slow,
for some operations, and you may still have 128-bit intmax_t on
a system with 64-bit long and 32-bit int, and 64-bit intmax_t on
a system with 32-bit long and int, and 64-bit long long, thus an
argument along the lines of "long makes the integer size gain a
non-normalised thing" would be bogus, I think. A better argument
might be for building i386 with 64-bit long (ha ha ha), and that
seems what you want- a wider type on a sucky architecture ;)
As for the INTMAX_LEN or whatnot, that's bogusish. There are ways
of (at run time) deducing the maximum size of a buffer for a
<fooint>, probably you can shove them into some init routine that
sh surely has.
Also, I don't know how we feel about C++/C99 style comments in
the base system.
Thanx,
juli (who imagines bde would have better advice.)
--
juli mallett. email: jmallett at freebsd.org; aim: bsdflata; efnet: juli;
More information about the freebsd-standards
mailing list