Fix warnings about narrowing conversions on 64-bit systems with 32-bit int

I have fixed some warnings appearing on (at least) MSVC12 64-bit, since int was used as difference type / size type, hence compiler warned about narrowing conversion (possible loss of data C4244).

Everything builds fine and tests pass on MSVC12 64-bit.

Still, there are lots of C4267 warnings about conversion from 'size_t' to 'int'