Categorygithub.com/seanmcadam/counter
repositorypackage
1.0.8
Repository: https://github.com/seanmcadam/counter.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

counter

Atomic counter

NewCounterX() creates a interface to a counter with X bits and returns a CounterStructInt{} The different sizes of counters are for limiting the size of the required byte array when the data is transmitted over the wire. Internaly the counters are processed as 64 bits when used.

type Counter counterint.CounterStructInt

You can atomicly get the next counter number by calling Next(), which returns a CounterInt To find out the depth of counter call Bits() => 8, 16, 32, 64 To convert a byte string to a CounterInt{} use ByteToCounter()

type Count counterint.CountInt

To get a uint64 of the counter value use Uint() To get the depth of the CounterInt{} use Bits() To convert to a properly sized []byte value use ToByte() To get a copy of the CounterInt use Copy()