Skip to content

user channel list 求余的问题 #56

@SongCF

Description

@SongCF
//func (l *ChannelList) Bucket(key string) *ChannelBucket 
idx := uint(h.Sum32()) & uint(Conf.ChannelBucket-1)  //其中 ChannelBucket = runtime.NumCPU()

只有当x=2^n(n为自然数)时,a % x = a & (x - 1 )才成立,
又服务器cpu至少我见过有10核12核的

那么这里就计算出的idx会有问题吧

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions