Use static casts instead of C casts, add floor-cast functions

Makes use of C++11 features, so I guess this can't be merged quite yet. 

@madmaxoft when will we be able to use these again?