prefer (X ? 1 : -1) when converting from boolean (1,0) to int (1,-1)
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 10 Oct 2010 20:36:34 +0000 (13:36 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 10 Oct 2010 20:36:53 +0000 (13:36 -0700)
commitfea1830d840868b6d5d66ee30bb56f322f109254
tree783d1b8e1a73c20fa03c02acdb61115b7bec47da
parente9e556f53c74014cb122e8c7fd0405f40f7c9acb
prefer (X ? 1 : -1) when converting from boolean (1,0) to int (1,-1)

Formerly the style was sometimes 2*X - 1, because the C standard
was wrongly thought to disallow ?: in integral constant expressions.
* lib/inet_ntop.c (verify_int_size): Rewrite 2*X-7 (!) to 4<=X?1:-1.
* lib/signal.in.h (verify_NSIG_constraint): Rewrite 2*X-1 to X?1:-1.
* lib/spawn.in.h (verify_POSIX_SPAWN_USEVFORK_no_overlap): Likewise.
* lib/stdint.in.h (_verify_intmax_size): Likewise.
* lib/time.in.h (struct __time_t_must_be_integral): Rewrite
2 * ((time_t) 1 / 2 == 0) - 1 to (time_t) 1; this suffices to
verify that time_t cannot be floating.
ChangeLog
lib/inet_ntop.c
lib/signal.in.h
lib/spawn.in.h
lib/stdint.in.h
lib/time.in.h