bnoordhuis/node-buffertools — Issue #25: Compare obey lexicographical order
Author: dfoody
Created: 2012-02-20 21:01:44+00:00
State: open

I suppose this is not technically a bug, but it would be great to have compare act more like a standard comparison algorithm so that buffers can be sorted "properly". That is, sorting buffers containing ascii text should sort the same way as sorting the same text lexicographically.

So, if you have the following buffers with the following bytes:
A: 00 00 00 00 (length 4)
B: ff ff (length 2)
C: ff ff 00 (length 3)
D: ff ff 01 (length 3)

They should sort as A, B, C, D.
The current compare algorithm would cause them to be sorted as B, C, D, A.