longest_prefix() optimization

Favour the common case where the last non-0xff byte occurs at or near
the end of string rather than the start.
Merge branch 'master' of github.com:dw/acid