Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
78a7f26b
Commit
78a7f26b
authored
Jan 15, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
28777de8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
39 deletions
+14
-39
go/neo/proto/protogen.go
go/neo/proto/protogen.go
+14
-39
No files found.
go/neo/proto/protogen.go
View file @
78a7f26b
...
...
@@ -463,54 +463,29 @@ func typeDecodingSizeFixed(encoding byte, typ types.Type) (wireSize int, ok bool
}
func
typeRxTxSizeFixed
(
encoding
byte
,
typ
types
.
Type
,
rx
bool
)
(
wireSize
int
,
ok
bool
)
{
switch
encoding
{
default
:
panic
(
"bad encoding"
)
// pass typ through sizerM and see if encoded size is fixed or not
// XXX make something not fixed when rx=true?
var
size
SymSize
switch
encoding
{
case
'M'
:
// pass typ through sizerM and see if encoded size is fixed or not
// XXX make something not fixed when rx=true?
s
:=
&
sizerM
{}
codegenType
(
"x"
,
typ
,
nil
,
s
)
if
!
s
.
size
.
IsNumeric
()
{
// no symbolic part
return
0
,
false
}
return
s
.
size
.
num
,
true
size
=
s
.
size
case
'N'
:
// implemented below
// XXX also pass through sizerN ?
}
switch
u
:=
typ
.
Underlying
()
.
(
type
)
{
case
*
types
.
Basic
:
basic
,
ok
:=
basicTypesN
[
u
.
Kind
()]
if
ok
{
return
basic
.
wireSize
,
ok
}
case
*
types
.
Struct
:
for
i
:=
0
;
i
<
u
.
NumFields
();
i
++
{
size
,
ok
:=
typeEncodingSizeFixed
(
encoding
,
u
.
Field
(
i
)
.
Type
())
if
!
ok
{
goto
notfixed
}
wireSize
+=
size
}
return
wireSize
,
true
s
:=
&
sizerN
{}
codegenType
(
"x"
,
typ
,
nil
,
s
)
size
=
s
.
size
case
*
types
.
Array
:
elemSize
,
ok
:=
typeEncodingSizeFixed
(
encoding
,
u
.
Elem
())
if
ok
{
return
int
(
u
.
Len
())
*
elemSize
,
ok
}
default
:
panic
(
"bad encoding"
)
}
notfixed
:
// everything else is of not fixed wire size
return
0
,
false
if
!
size
.
IsNumeric
()
{
// no symbolic part
return
0
,
false
}
return
size
.
num
,
true
}
// interface of a codegenerator (for sizer/encoder/decoder)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment