This is the mail archive of the
mailing list for the glibc project.
Re: Patch for locale/programs/3level.h
- To: libc-alpha at sources dot redhat dot com
- Subject: Re: Patch for locale/programs/3level.h
- From: Bruno Haible <haible at ilog dot fr>
- Date: Mon, 6 Aug 2001 22:25:39 +0200 (CEST)
- Cc: Andreas Jaeger <aj at suse dot de>
> We noticed a problem with ~0 nesting in 3level.h. The following looks
> more sane to me.
> - if (lookup1 != ~((uint32_t) 0))
> + if (lookup1 != (uint32_t) ~0)
The values are not the same. If someone were to use this code with a
compiler that has 'int' == 'int16_t' (which is not too far away, it
was long time the default for some m68k gcc ports), the values are
~((uint32_t) 0) = 0xFFFFFFFF
(uint32_t) ~0 = 0x0000FFFF
The first value is definitely the intended one.
Therefore the code is more robust and portable as it is.