changed integer type from size_t to be ptrdiff_t (the signed integer type used for pointer subtraction)