Fix build errors

Fix build errors generated by gcc 7 and clang on FreeBSD/amd64

98cf06e should be checked for whether selected type (int) is long enough (long long may be required instead).