Bit-twiddling hack where we don't have intrinsics.
Merge branch 'issue-17' into develop