Hmm... I wrote the code something like 6 or 7 years ago... so I don't remember exactly how it works. But I remember that it does work and that I got the switch values by printing the values that actually end up into g in the real board. There's a lot of shifting going on to set GPIO bits into different, non-clashing positions when multiplexing the keys, so it's rather difficult to see from the code where each GPIO bit actually does end up, for me anyway.
I remember that the code worked, and nobody has complained about it so far. That doesn't mean that there cannot be any errors, so please report me how exactly your real board behaves and we can take a look at it.
Panu mentioned shifting, so should
g |= (USEX(GPIO_IDATA) & ((1<<10)|(1<<8)|(1<<11))) >> 0;
be
g |= (USEX(GPIO_IDATA) & ((1<<10)|(1<<8)|(1<<11))) >> 8;
?
(Why shift with 0?)