Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Unified Diff: common/cmpbin/doc.go

Issue 1322713002: Add a bit more documentation flavor to cmpbin. (Closed) Base URL: https://github.com/luci/luci-go.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: common/cmpbin/doc.go
diff --git a/common/cmpbin/doc.go b/common/cmpbin/doc.go
index 2974be238017f3d753ca93bb459c7a58c48e30a3..70741e49b948b93389579f7e11de18c7b2d62e29 100644
--- a/common/cmpbin/doc.go
+++ b/common/cmpbin/doc.go
@@ -5,7 +5,13 @@
// Package cmpbin provides binary serialization routines which ensure that the
// serialized objects maintain the same sort order of the original inputs when
// sorted bytewise (i.e. with memcmp). Additionally, serialized objects are
-// concatenatable.
+// concatenatable, and the concatenated items will behave as if they're compared
+// field-to-field. So, for example, comparing each string in a []string would
+// compare the same way as comparing the concatenation of those strings encoded
+// with cmpbin. Simply concatenating the strings without encoding them will
+// NOT retain this property, as you could not distinguish []string{"a", "aa"}
+// from []string{"aa", "a"}. With cmpbin, these two would unambiguously sort as
+// ("a", "aa") < ("aa", "a").
//
// Notes on particular serialization schemes:
//
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698