[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gnulib] FYI: comment nits in intprops.h
From: |
Paul Eggert |
Subject: |
Re: [bug-gnulib] FYI: comment nits in intprops.h |
Date: |
Sat, 26 Mar 2005 10:22:45 -0800 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux) |
Jim Meyering <address@hidden> writes:
> 2005-03-26 Jim Meyering <address@hidden>
>
> Comment nits.
> * intprops.h: Add the apostrophe in `(one|two)'s complement'.
> Correct typos: s/or/of/.
Thanks for picking that up. However, I just checked Knuth Volume 2
(3rd edition, section 4.1, pages 203-204), and the correct spelling is
"ones' complement". The idea is that "two's complement" complements
with respect to a single power of 2; "ones' complement" complements
with respect to 111111....1, so it uses the plural possessive. I
never could remember this detail, which is why I sometimes lazily
omitted the apostrophe. Knuth goes on to describe "twos' complement",
which is base 3 and complements with respect to 22222....2. (I guess
I'll remember this stuff better now. :-)
Also, the /or/of/ fix isn't quite right, since the comment was
intended to say that the argument can be either a type or an
expression yielding a value of a type. And the patches should be
propogated to the glibc files.
So I installed the following:
2005-03-26 Paul Eggert <address@hidden>
* intprops.h:
"one's complement" -> "ones' complement" in comment, as per Knuth.
"value of type" -> "type or expression" in comment.
* mktime.c, strftime.c: Propagate intprops.h comment nits.
Index: lib/intprops.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/intprops.h,v
retrieving revision 1.3
retrieving revision 1.5
diff -p -u -r1.3 -r1.5
--- lib/intprops.h 26 Mar 2005 11:10:52 -0000 1.3
+++ lib/intprops.h 26 Mar 2005 17:53:44 -0000 1.5
@@ -28,7 +28,7 @@
#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
/* True if negative values of the signed integer type T use two's
- complement, one's complement, or signed magnitude representation,
+ complement, ones' complement, or signed magnitude representation,
respectively. Much GNU code assumes two's complement, but some
people like to be portable to all possible C hosts. */
#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
@@ -53,13 +53,13 @@
? (t) -1 \
: ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
-/* Bound on length of the string representing an integer value of type T.
+/* Bound on length of the string representing an integer type or expression T.
Subtract 1 for the sign bit if t is signed; log10 (2.0) < 146/485;
add 1 for integer division truncation; add 1 more for a minus sign
if needed. */
#define INT_STRLEN_BOUND(t) \
((sizeof (t) * CHAR_BIT - 1) * 146 / 485 + 2)
-/* Bound on buffer size needed to represent an integer value of type T,
+/* Bound on buffer size needed to represent an integer type or expression T,
including the terminating null. */
#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
Index: lib/mktime.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/mktime.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -p -u -r1.49 -r1.50
--- lib/mktime.c 15 Mar 2005 00:39:17 -0000 1.49
+++ lib/mktime.c 26 Mar 2005 18:08:56 -0000 1.50
@@ -68,9 +68,9 @@
an integer. */
#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
-/* True if negative values of the signed integer type T use twos
- complement, ones complement, or signed magnitude representation,
- respectively. Much GNU code assumes twos complement, but some
+/* True if negative values of the signed integer type T use two's
+ complement, ones' complement, or signed magnitude representation,
+ respectively. Much GNU code assumes two's complement, but some
people like to be portable to all possible C hosts. */
#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
Index: lib/strftime.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/strftime.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -p -u -r1.81 -r1.82
--- lib/strftime.c 19 Mar 2005 05:34:28 -0000 1.81
+++ lib/strftime.c 26 Mar 2005 18:08:56 -0000 1.82
@@ -120,7 +120,7 @@ extern char *tzname[];
? (a) >> (b) \
: (a) / (1 << (b)) - ((a) % (1 << (b)) < 0))
-/* Bound on length of the string representing an integer value or type T.
+/* Bound on length of the string representing an integer type or expression T.
Subtract 1 for the sign bit if t is signed; log10 (2.0) < 146/485;
add 1 for integer division truncation; add 1 more for a minus sign
if needed. */