Skip to content
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

runtime/mpallocbits.go pallocBits.summarize function problem #39990

Closed
web3creator opened this issue Jul 2, 2020 · 6 comments
Closed

runtime/mpallocbits.go pallocBits.summarize function problem #39990

web3creator opened this issue Jul 2, 2020 · 6 comments

Comments

@web3creator
Copy link

web3creator commented Jul 2, 2020

golang1.14.3 linux amd64

example

   var p1 pageBits
p1[0]=0b00000000_00000000_00000000_00000001_00000000_00000000_00000000_00000000
p1[1]=0b00000000_00000000_00000000_00000001_00000000_00000000_00000000_11110000
p1[2]=0b00000000_00000000_00000000_00000001_00000000_00000000_00000000_11110000
p1[3]=0b00000000_00000000_00000000_00000001_00000000_00000000_00000000_11110000
p1[4]=0b00000000_00000000_00000000_00000001_00000000_00000000_00000000_11110000
p1[5]=0b00000000_00000000_00000000_00000001_00000000_00000000_00000000_00000000
p1[6]=0b00000000_00000000_00000000_00000000_00000000_00000000_00000000_11110000
p1[7]=0b00000000_00000000_00000000_00000001_00000000_00000000_00000000_01010000
    p1summarize()
   
   // return start:32   max:63  end:31
   // I think it should return start:32 max:88 end31
  // What is the strategy of this summarizefunction when calculating max
@web3creator web3creator changed the title about pallocBits.summarize function problem untime/mpallocbits.go pallocBits.summarize function problem Jul 2, 2020
@web3creator web3creator changed the title untime/mpallocbits.go pallocBits.summarize function problem runtime/mpallocbits.go pallocBits.summarize function problem Jul 2, 2020
@ianlancetaylor
Copy link
Contributor

CC @mknyszek

@web3creator
Copy link
Author

I think the function summarize has a bug, @mknyszek think?

@randall77
Copy link
Contributor

Why would max be 88? The max is 63. The high 31 zeroes of p1[4] and the low 32 zeroes of p1[5].

@web3creator
Copy link
Author

Why would max be 88? The max is 63. The high 31 zeroes of p1[4] and the low 32 zeroes of p1[5].

@randall77 , I think it should be The high 56 zeroes of p1[6] and the low 32 zeroes of p1[5].Where do I understand the deviation?

@randall77
Copy link
Contributor

The bits are ordered from low to high in each word, then in increasing word index. So the high 56 zeroes of p1[6] are adjacent to the low 4 zeroes of p1[7], not the low 32 zeroes p1[5].

This doesn't look like a bug to me.

@web3creator
Copy link
Author

@randall77 Thank you for your answer, you're right.

@golang golang locked and limited conversation to collaborators Jul 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants