Commit graph

9 commits

Author SHA1 Message Date
Roman Khimov
e7687d620d io: simplify WriteBytes()
Which speeds it up at least twofold for a typical 32-bytes write (and that's
for a very naïve test that allocates new BufBinWriter on every iteration):

pkg: github.com/CityOfZion/neo-go/pkg/io
BenchmarkWriteBytes-8           10000000               124 ns/op
BenchmarkWriteBytesOld-8         5000000               251 ns/op
2019-12-06 17:40:47 +03:00
Vsevolod Brekelov
5a41da0e1a io: add missing test 2019-12-03 16:20:06 +03:00
Vsevolod Brekelov
03ff2976ed io: refactoring for using WriteVarBytes instead of WriteLE
goal is to be consistent with C# implementation.
For writing []byte WriteBytes used and for byte - WriteVarByte.
2019-12-03 13:49:33 +03:00
Vsevolod Brekelov
d02673c112 vm: add bufBinWriter to emit functions in order to catch errors 2019-12-02 13:04:33 +03:00
Evgenii Stratonikov
f65545023d io: restrict ReadArray max array size 2019-11-15 22:39:21 +03:00
Evgenii Stratonikov
b16e56a47b io: refactor BinReader.ReadArray()
Make it accept arbitrary slice pointer.
2019-11-14 14:19:58 +03:00
Evgenii Stratonikov
ad9091d13d io: implement generic array (de-)serialization
It is done through reflection and panics
in every unexpected situation.
2019-11-13 17:27:23 +03:00
Roman Khimov
e5ed7a7eb7 io: fix lintian suggestions in test code
golint:
  pkg/io/binaryrw_test.go:25:11: should omit type []byte from declaration of var bin; it will be inferred from the right-hand side
  pkg/io/binaryrw_test.go:42:11: should omit type []byte from declaration of var bin; it will be inferred from the right-hand side
  pkg/io/binaryrw_test.go:118:7: should omit type string from declaration of var str; it will be inferred from the right-hand side
2019-10-17 12:25:36 +03:00
Roman Khimov
5bf00db2c9 io: move BinReader/BinWriter there, redo Serializable with it
The logic here is that we'll have all binary encoding/decoding done via our io
package, which simplifies error handling. This functionality doesn't belong to
util, so it's moved.

This also expands BufBinWriter with Reset() method to fit the needs of core
package.
2019-09-16 23:39:51 +03:00
Renamed from pkg/util/binaryrw_test.go (Browse further)