8000 math:big 一个简单的优化 by SparrowLii · Pull Request #17 · MabinGo/go · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

math:big 一个简单的优化 #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

SparrowLii
Copy link

用table查找代替了计算过程

测试正确性:
func TESTMaxPow() {
for i := 2; i <= 62; i++ {
b:=Word(i)
p, n := b, 1
for max := (_M) / b; p <= max; {
p *= b
n++
}
pGot,nGot:=maxPow(b)
if p != pGot || n != nGot {
fmt.Errorf("not right!")
}
}
fmt.Println("right")
}
输出: right

Fixes golang#39406
When use checkForResumption() function it could be side-effect sometime.
1. hs.sessionState will be changed and retained although the function return false.
2. hs.suite will be changed and retained when the statements below return false.
So  we should use a local variable, cilentSessionState, to replace hs.sessionState in the function. And move the set-suite statements down to avoid being changed too early.
用table查找代替了计算的过程
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0