In Programming in the Key of C#, the author gives an example (with source code) on how a date (year, month, day -- in numbers) can be packed in a 32 bit integer. In the example, the author packs the information like so:
int iDate = (iYear << 9) | (iMonth << 5) | iDay;
If I'm grasping this properly, a left shift of 9 gives us just a value of 512 (or 1023 if counting every bit position). However, I notice when running the program values like 2014 (year) can be stored. How is this possible with such a small value? Am I misunderstanding a piece of this code? No amount of reading, watching or toying with the code has helped me clear the air.