Re: BUG #5237: strange int->bit and bit->int conversions

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #5237: strange int->bit and bit->int conversions
Дата
Msg-id 11277.1260646119@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #5237: strange int->bit and bit->int conversions  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-bugs
Robert Haas <robertmhaas@gmail.com> writes:
>> I'm not sure this fixes it, although I haven't tested.  When we take
>> the /* store first fractional byte */ branch, destbitsleft is between
>> 1 and 7 bits greater than srcbitsleft.  We then subtract 8 from
>> destbitsleft, and the comment on the next line now asserts that the
>> two are equal.  That doesn't seem right.

The comment's a bit bogus.  What it should say, probably, is that the
*correct* value of srcbitsleft is now equal to destbitsleft so we aren't
bothering to track it anymore.  If we were being fully anal we'd have
reduced srcbitsleft by some number less than 8 inside the if-branch.

>> Also, I thought about the sign extension problem, but aren't we
>> chopping those bits off anyway on the next line?

Nope, we'd have already stored the wrong bits into the output byte.

            regards, tom lane

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: BUG #5237: strange int->bit and bit->int conversions
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #5238: frequent signal 11 segfaults