Patch for locale/programs/3level.h

Bruno Haible haible@ilog.fr
Mon Aug 6 13:27:00 GMT 2001


> 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.

Bruno



More information about the Libc-alpha mailing list