buffer: normalize compare() output

Because of differences in memcmp() implementation, normalize output to
return -1, 0 or 1 only.