Using ARM CC compiler V5.06 update 3 (build 300). I see some quirkiness with macro calculations when using a preprocessor macro that refers to other macros. It seems the value is byte trimmed. Tried several optimization flags but the behavior is the same.
bleyer.org/.../armcc_macrobug.gif
If I extract the function from the project and compile it standalone then the issue is gone, so I suspect the preprocessor or the compiler gets confused from whatever happens on a bigger project.