Re: macaddr 64 bit (EUI-64) datatype support

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: macaddr 64 bit (EUI-64) datatype support
Дата
Msg-id 32372.1476305527@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: macaddr 64 bit (EUI-64) datatype support  (Vitaly Burovoy <vitaly.burovoy@gmail.com>)
Ответы Re: macaddr 64 bit (EUI-64) datatype support  (Vitaly Burovoy <vitaly.burovoy@gmail.com>)
Список pgsql-hackers
Vitaly Burovoy <vitaly.burovoy@gmail.com> writes:
> I'm sorry for the offtopic, but does anyone know a reason why a
> condition in mac.c

>> if ((a < 0) || (a > 255) || (b < 0) || (b > 255) ||
>> (c < 0) || (c > 255) || (d < 0) || (d > 255) ||
>> (e < 0) || (e > 255) || (f < 0) || (f > 255))

> can not be rewritten as:

>> if (((a | b | c | d | e | f) < 0) ||
>> ((a | b | c | d | e | f) > 255))

Well, it's ugly and it adds a bunch of assumptions about arithmetic
behavior that we don't particularly need to make.  If this were some
amazingly hot hot-spot then maybe it would be worth making the code
unreadable to save a few nanoseconds, but I doubt that it is.
(Anyway, you've not shown that there actually is any benefit ...)
        regards, tom lane



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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: macaddr 64 bit (EUI-64) datatype support
Следующее
От: Tom Lane
Дата:
Сообщение: Re: macaddr 64 bit (EUI-64) datatype support