Skip to content

[ring]: getMinimumGap returns incoherent values #532

@Pro7ech

Description

@Pro7ech

The following piece of code of the function

func getMinimumGap(list []int) (gap, logGap int, err error) {

is incoherent:

for gap&1 == 0 {
	logGap++  // gap.trailing_zeros()
	gap >>= 1 // gap >> gap.trailing_zeros()
}

but x.trailing_zeros() != (x >> x.trailing_zeros()).bit_length().

edit: the naming logGap is misleading, but the returned value is what is expected by the other methods that call it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions