Change #sql_in_for_flag to consider values from the range [0, 2 * max - 1]

This change has the side-effect of making `chained_flags_condition` work with
all negative flags (0 is a possible value returned by `sql_in_for_flag`).