Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
b7c5e23d
Commit
b7c5e23d
authored
Jun 13, 2012
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
math/big: various cleanups
R=golang-dev, iant CC=golang-dev
https://golang.org/cl/6295072
parent
38735b95
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
15 deletions
+12
-15
src/pkg/math/big/nat.go
src/pkg/math/big/nat.go
+12
-15
No files found.
src/pkg/math/big/nat.go
View file @
b7c5e23d
...
...
@@ -493,14 +493,9 @@ func (z nat) div(z2, u, v nat) (q, r nat) {
}
if
len
(
v
)
==
1
{
var
rprime
Word
q
,
rprime
=
z
.
divW
(
u
,
v
[
0
])
if
rprime
>
0
{
r
=
z2
.
make
(
1
)
r
[
0
]
=
rprime
}
else
{
r
=
z2
.
make
(
0
)
}
var
r2
Word
q
,
r2
=
z
.
divW
(
u
,
v
[
0
])
r
=
z2
.
setWord
(
r2
)
return
}
...
...
@@ -1011,7 +1006,7 @@ func trailingZeroBits(x Word) uint {
case
64
:
return
uint
(
deBruijn64Lookup
[((
x
&-
x
)
*
(
deBruijn64
&
_M
))
>>
58
])
default
:
panic
(
"
U
nknown word size"
)
panic
(
"
u
nknown word size"
)
}
return
0
...
...
@@ -1198,17 +1193,19 @@ func (z nat) random(rand *rand.Rand, limit nat, n int) nat {
mask
:=
Word
((
1
<<
bitLengthOfMSW
)
-
1
)
for
{
for
i
:=
range
z
{
switch
_W
{
case
32
:
switch
_W
{
case
32
:
for
i
:=
range
z
{
z
[
i
]
=
Word
(
rand
.
Uint32
())
case
64
:
}
case
64
:
for
i
:=
range
z
{
z
[
i
]
=
Word
(
rand
.
Uint32
())
|
Word
(
rand
.
Uint32
())
<<
32
}
default
:
panic
(
"unknown word size"
)
}
z
[
len
(
limit
)
-
1
]
&=
mask
if
z
.
cmp
(
limit
)
<
0
{
break
}
...
...
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