User blog comment:RottenBlock/System 3 Compilation, Part 5/@comment-44256294-20200122141129

My guess is the mask is just to force alignment to 8px columns. Note that (x & 0xFFF8) essentialy rounds down to the nearest multiple of 8.