Factor out bit manipulation logic to helper.

I already have three copies of this loop, and was contemplating a
fourth. Let's factor it out to a helper function.

Change-Id: Ic3c190232eaae06056daeddf2a7a34bd1db9c210
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/646396
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Herb Derby <herb@google.com>
1 file changed