Optimized ByteExtensions by replacing HasFlag() usage with bit masking

Increases performance significantly - many thanks to Mike Krueger for
suggesting this (many moons ago, although I am now just getting around
to testing it).