Add safe_int_cast.h

Provides some methods to safely cast between different integer types.
Note: Only tested on mingw-4.8.1-x64.