Add casts to avoid errors due to narrowing

This fixes building in C++11 mode, which normally errors out
on narrowing hex literals to signed long.

This is similar to what was done in git commit ef30836651
(change id I64d19a8a8059c5a96386b1eaac297fd2469515f8), completing
the fix for that category of issues.

Change-Id: I1907bc947d43bf44910fb2b34bf2b31c0e53aa53
4 files changed