Rework is_binary()

See the commit messages for the changes.

It will be faster for plain ASCII (which will go round the main
for loop upto 512 times), but slightly slower for binary files
containing NULs - which typically happens long before 512 bytes
in.

In general this will be faster. Hopefully it's clearer too.

Cheers, alex.