Why not this:

    WRITE(p, "  int y_block_position = uv1.y & %d;\n", ~(blkH-1));