Small mistake in RENO code
Chris Torek
torek at elf.ee.lbl.gov
Mon Jun 24 11:22:28 AEST 1991
In article <1991Jun22.080642.27211 at m.cs.uiuc.edu> march at cs.uiuc.edu
(Steve March) writes:
>In the file ..../sys/netinet/in.c, in the routine in_sockmaskof(), the
>variable mask is declared u_long (line 102) but is later assigned a
>negative value in line 115. Doesn't look right to me.
The code in question is:
register u_long mask;
...
mask = -1;
which is intended to set `mask' to all-ones. Since all the machines on
which 4BSD runs are 2's complement, this is fine; it would, however, be
better in some sense to use
mask = ~0UL;
so as to guarantee this result in all cases. Unfortunately, `U'-suffixed
constants are not recognized by the 4.3-reno Vax and Tahoe C compilers.
Perhaps `mask = ~0L' would suffice. :-)
--
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427)
Berkeley, CA Domain: torek at ee.lbl.gov
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list