Fixed incorrect initialization of ptr_size variable
Using div() function since it's faster than two separate '/' and '%' operations