ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Суббота
20 апреля
307150 Топик полностью
Сергей Борщ (13.02.2012 11:35, просмотров: 311) ответил koyodza на да. Нормальный компилятор сам вместо деления сдвиги подставит когда нужно. Насчёт сдвига вправо в разных местах информация немного различается
В первом случае все верно - они описывают свой компилятор. По второй ссылке они противоречат стандарту, ибо стандарт ясно говорит: 
3.4.1 1 implementation-defined behavior unspecified behavior where each implementation documents how the choice is made 2 EXAMPLE An example of implementation-defined behavior is the propagation of the high-order bit when a signed integer is shifted right.
6.5.7 Bitwise shift operators .... 5 The result of E1 >> E2 is E1 right-shifted E2 bit positions. If E1 has an unsigned type or if E1 has a signed type and a nonnegative value, the value of the result is the integral part of the quotient of E1/2^E2. If E1 has a signed type and a negative value, the resulting value is implementation-defined.