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
0fe02aeb
Commit
0fe02aeb
authored
Nov 30, 2019
by
zhanghuiren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update comments and unused code
parent
b75faeb2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
8 deletions
+5
-8
integer.go
math/big/integer.go
+5
-8
No files found.
math/big/integer.go
View file @
0fe02aeb
...
...
@@ -27,10 +27,12 @@ import (
type
Integer
struct
{
bigInt
big
.
Int
// for hessian
// 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
...
...
@@ -47,12 +49,10 @@ func (i *Integer) FromString(s string) error {
if
!
ok
||
intPtr
==
nil
{
return
fmt
.
Errorf
(
"'%s' is not a 10-based number"
,
s
)
}
i
.
bigInt
=
*
intPtr
return
nil
}
// From
Mag set data from a array of big-endian unsigned uint32
// From
SignAndMag set data from a array of big-endian unsigned uint32, it's used in hessian decoding
// @see https://docs.oracle.com/javase/8/docs/api/java/math/BigInteger.html#BigInteger-int-byte:A-
func
(
i
*
Integer
)
FromSignAndMag
(
signum
int32
,
mag
[]
int
)
{
if
signum
==
0
&&
len
(
mag
)
==
0
{
...
...
@@ -73,6 +73,7 @@ func (i *Integer) FromSignAndMag(signum int32, mag []int) {
}
}
// GetSignAndMag is used in hessian encoding
func
(
i
*
Integer
)
GetSignAndMag
()
(
signum
int32
,
mag
[]
int
)
{
signum
=
int32
(
i
.
bigInt
.
Sign
())
...
...
@@ -106,7 +107,3 @@ func (i *Integer) SetBigInt(bigInt big.Int) {
func
(
i
*
Integer
)
String
()
string
{
return
i
.
bigInt
.
String
()
}
func
(
i
*
Integer
)
Bytes
()
[]
byte
{
return
i
.
bigInt
.
Bytes
()
}
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