Fix two warnings from gcc and clang

gcc complained about the cast to int and clang complained about both.