dispatch_apply((h - c - b - a + d - 1)/d, dispatch_main(), ^(blkId) {
m[blkId] = n[blkId] - p[blkId]
});
UPDATE: following should have the same result
dispatch_apply(ceil((double)(h - c - b - a) / d ), dispatch_main(), ^(blkId) {
m[blkId] = n[blkId] - p[blkId]
});
in first variant I have used that (int)ceil( x / y ) == (int)( x + y - 1 / y )