При написании функций можно использовать только следующее: - целочисленные константы; - целочисленные аргументы функций и автоматические (локальные)переменные; - операции ~ ! + - (тип) << >> & ^ | . Группы операций расположены в порядке убывания приоритета.
int MoveRight(int x, int n, int onebit); MoveRight - сдвигает х вправо на n разрядов с заполнением значением
onebit (only 0 or 1) freed bits Examples: MoveRight (0x123,4,1) = 0xF012 MoveRight (0x123,4,0) = 0x12
Thank you very much
n
higher digits and after the shift you impose it on the result (through OR). And determine the bitness of the argument in sizeof. Respectively in bitssizeof(x) \* CHAR_BIT
(from limits.h) will turn out. Just do not forget that the sign bit is the oldest. When you shift signed to the right, it is distributed. So, you can just play around with casting. That is, in fact, the whole "theory". (Deciphering unfamiliar words can google). - avp