Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
G
gostnops
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wei.xuan
gostnops
Commits
977f1e1d
Commit
977f1e1d
authored
Nov 30, 2019
by
zhanghuiren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add integer stub for hessian
parent
11185138
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
18 deletions
+28
-18
integer.go
math/big/integer.go
+28
-18
No files found.
math/big/integer.go
View file @
977f1e1d
...
...
@@ -26,17 +26,6 @@ import (
// Integer represents a integer value.
type
Integer
struct
{
big
.
Int
// only used for hessian
// You Should not use it in go
Signum
int32
Mag
[]
int
// Deprecated: compatible with java8 serialize
FirstNonzeroIntNum
int
LowestSetBit
int
BitLength
int
BitCount
int
}
func
(
Integer
)
JavaClassName
()
string
{
...
...
@@ -59,16 +48,13 @@ func (i *Integer) FromSignAndMag(signum int32, mag []int) {
return
}
i
.
Signum
=
signum
i
.
Mag
=
mag
bytes
:=
make
([]
byte
,
4
*
len
(
i
.
Mag
))
for
j
:=
0
;
j
<
len
(
i
.
Mag
);
j
++
{
binary
.
BigEndian
.
PutUint32
(
bytes
[
j
*
4
:
(
j
+
1
)
*
4
],
uint32
(
i
.
Mag
[
j
]))
bytes
:=
make
([]
byte
,
4
*
len
(
mag
))
for
j
:=
0
;
j
<
len
(
mag
);
j
++
{
binary
.
BigEndian
.
PutUint32
(
bytes
[
j
*
4
:
(
j
+
1
)
*
4
],
uint32
(
mag
[
j
]))
}
i
.
SetBytes
(
bytes
)
if
i
.
S
ignum
==
-
1
{
if
s
ignum
==
-
1
{
i
.
Neg
(
&
i
.
Int
)
}
}
...
...
@@ -93,3 +79,27 @@ func (i *Integer) GetSignAndMag() (signum int32, mag []int) {
return
}
func
(
i
*
Integer
)
GetIntegerStub
()
(
stub
*
IntegerStub
)
{
stub
=
new
(
IntegerStub
)
stub
.
Signum
,
stub
.
Mag
=
i
.
GetSignAndMag
()
return
}
func
(
i
*
Integer
)
SetIntegerStub
(
stub
*
IntegerStub
)
{
i
.
FromSignAndMag
(
stub
.
Signum
,
stub
.
Mag
)
return
}
// IntegerStub is used for hessian encoding and decoding
// You Should not use it in go
type
IntegerStub
struct
{
Signum
int32
Mag
[]
int
// Deprecated: compatible with java8 serialize
FirstNonzeroIntNum
int
LowestSetBit
int
BitLength
int
BitCount
int
}
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