aboutsummaryrefslogtreecommitdiff
path: root/binary/cyclic
diff options
context:
space:
mode:
authorBen Clayton <bclayton@google.com>2015-05-11 15:04:52 +0100
committerBen Clayton <bclayton@google.com>2015-05-11 15:04:52 +0100
commit409e85dc0f15cdc14f551187b1fae8e503a87ba8 (patch)
tree4bd036d521338148d2cb555463422867cdcaa8b0 /binary/cyclic
parent8b1c83e85e1009ff7c2e519356186755240915dc (diff)
downloadgpu-409e85dc0f15cdc14f551187b1fae8e503a87ba8.tar.gz
Add markdown documentation generated from godoc
Change-Id: I27cd0bba6cc5a5419e16f99cdcfec2bfb8c05f7f
Diffstat (limited to 'binary/cyclic')
-rw-r--r--binary/cyclic/README.mk36
1 files changed, 36 insertions, 0 deletions
diff --git a/binary/cyclic/README.mk b/binary/cyclic/README.mk
new file mode 100644
index 000000000..25c591e09
--- /dev/null
+++ b/binary/cyclic/README.mk
@@ -0,0 +1,36 @@
+# cyclic
+--
+ import "android.googlesource.com/platform/tools/gpu/binary/cyclic"
+
+Object encoding details
+
+Objects are encoded in three different forms, depending on whether the object
+was nil, or was already encoded to the stream. If the object is non-nil and is
+encoded for the first time for a given Encoder then the object is encoded as:
+
+ key uint32 // A unique identifier for the object instance
+ type [20]byte // A unique identifier for the type of the object
+ ...data... // The object's data (length dependent on the object type)
+
+All subsequent encodings of the object are encoded as the 16 bit key identifier
+without any additional data:
+
+ key uint32 // An identifier of a previously encoded object instance
+
+If the object is nil, then the object is encoded as a uint32 of 0.
+
+## Usage
+
+#### func Decoder
+
+```go
+func Decoder(reader binary.Reader) *decoder
+```
+Decoder creates a binary.Decoder that reads from the provided binary.Reader.
+
+#### func Encoder
+
+```go
+func Encoder(writer binary.Writer) binary.Encoder
+```
+Encoder creates a binary.Encoder that writes to the supplied binary.Writer.