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

Side by Side 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, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Package cmpbin provides binary serialization routines which ensure that the 5 // Package cmpbin provides binary serialization routines which ensure that the
6 // serialized objects maintain the same sort order of the original inputs when 6 // serialized objects maintain the same sort order of the original inputs when
7 // sorted bytewise (i.e. with memcmp). Additionally, serialized objects are 7 // sorted bytewise (i.e. with memcmp). Additionally, serialized objects are
8 // concatenatable. 8 // concatenatable, and the concatenated items will behave as if they're compared
9 // field-to-field. So, for example, comparing each string in a []string would
10 // compare the same way as comparing the concatenation of those strings encoded
11 // with cmpbin. Simply concatenating the strings without encoding them will
12 // NOT retain this property, as you could not distinguish []string{"a", "aa"}
13 // from []string{"aa", "a"}. With cmpbin, these two would unambiguously sort as
14 // ("a", "aa") < ("aa", "a").
9 // 15 //
10 // Notes on particular serialization schemes: 16 // Notes on particular serialization schemes:
11 // 17 //
12 // - Numbers: 18 // - Numbers:
13 // The number encoding is less efficient on average than Varint 19 // The number encoding is less efficient on average than Varint
14 // ("encoding/binary") for small numbers (it has a minimum encoded size of 20 // ("encoding/binary") for small numbers (it has a minimum encoded size of
15 // 2 bytes), but is more efficient for large numbers (it has a maximum encoded 21 // 2 bytes), but is more efficient for large numbers (it has a maximum encoded
16 // size of 9 bytes for a 64 bit int, unlike the largest Varint which has a 10b 22 // size of 9 bytes for a 64 bit int, unlike the largest Varint which has a 10b
17 // representation). 23 // representation).
18 // 24 //
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // - SNaN - 0xFFF0000000000001 88 // - SNaN - 0xFFF0000000000001
83 // - +inf - 0xFFF0000000000000 89 // - +inf - 0xFFF0000000000000
84 // - MaxFloat64 - 0xFFEFFFFFFFFFFFFF 90 // - MaxFloat64 - 0xFFEFFFFFFFFFFFFF
85 // - SmallestNonzeroFloat64 - 0x8000000000000001 91 // - SmallestNonzeroFloat64 - 0x8000000000000001
86 // - 0 - 0x8000000000000000 92 // - 0 - 0x8000000000000000
87 // - -0 - 0x7FFFFFFFFFFFFFFF 93 // - -0 - 0x7FFFFFFFFFFFFFFF
88 // - -SmallestNonzeroFloat64 - 0x7FFFFFFFFFFFFFFE 94 // - -SmallestNonzeroFloat64 - 0x7FFFFFFFFFFFFFFE
89 // - -MaxFloat64 - 0x0010000000000000 95 // - -MaxFloat64 - 0x0010000000000000
90 // - -inf - 0x000FFFFFFFFFFFFF 96 // - -inf - 0x000FFFFFFFFFFFFF
91 package cmpbin 97 package cmpbin
OLDNEW
« 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