Diff

Differences From Artifact [bab2f5c2b7]:

To Artifact [36b31aa589]:


    53     53   	return
    54     54   }
    55     55   
    56     56   // Returns an integer from a fibonacci code as specified in the package doc.
    57     57   func (f Numbers) Decode(value uint64) (result uint64) {
    58     58   	i := 1
    59     59   	for (value & 3) != 3 {
           60  +		// Add the fibonacci number for the current bit if it is raised
    60     61   		if (value & 1) == 1 {
    61     62   			result += f.Nth(i)
           63  +
           64  +			// We know that the next bit cannot be raised by Zeckendorf's theorem
           65  +			value >>= 2
           66  +			i += 2
           67  +			continue
    62     68   		}
           69  +
    63     70   		value >>= 1
    64     71   		i++
    65     72   	}
    66     73   	result += f.Nth(i) - 1
    67     74   	return
    68     75   }