2009-04-01
another c puzzle
You probably know how to clear the lsb in a word, right?
Now, imagine the word (or an int, or a long, whatever) is split into pairs of bits. How the hell can I clear the last non-zero pair?
E.g.
0 -> 0
1 -> 0
2 -> 0
3 -> 0
4 -> 4
5 -> 4
6 -> 4
7 -> 4
...
0xfe000 -> 0xfc000
...
Now, imagine the word (or an int, or a long, whatever) is split into pairs of bits. How the hell can I clear the last non-zero pair?
E.g.
0 -> 0
1 -> 0
2 -> 0
3 -> 0
4 -> 4
5 -> 4
6 -> 4
7 -> 4
...
0xfe000 -> 0xfc000
...
а что приборы показывают при пересечении 180-го меридиана?
Ну типа джипиэс какой-нибудь у вас, типа гармина, или просто на телефоне; и вы приехали на Северные Фиджи.