comparison tests/test-revlog-raw.py @ 51700:7f0cb9ee0534

Backout accidental publication of a large range of revisions I accidentally published 25e7f9dcad0f::bd1483fd7088, this is the inverse.
author Raphaël Gomès <rgomes@octobus.net>
date Tue, 23 Jul 2024 10:02:46 +0200
parents 493034cc3265
children ca7bde5dbafb
comparison
equal deleted inserted replaced
51699:bd1483fd7088 51700:7f0cb9ee0534
244 244
245 The combination of two adjacent numbers will cover all possible cases. 245 The combination of two adjacent numbers will cover all possible cases.
246 That is to say, given any x, y where both x, and y are in range(2 ** n), 246 That is to say, given any x, y where both x, and y are in range(2 ** n),
247 there is an x followed immediately by y in the generated sequence. 247 there is an x followed immediately by y in the generated sequence.
248 """ 248 """
249 m = 2**n 249 m = 2 ** n
250 250
251 # Gray Code. See https://en.wikipedia.org/wiki/Gray_code 251 # Gray Code. See https://en.wikipedia.org/wiki/Gray_code
252 gray = lambda x: x ^ (x >> 1) 252 gray = lambda x: x ^ (x >> 1)
253 reversegray = {gray(i): i for i in range(m)} 253 reversegray = {gray(i): i for i in range(m)}
254 254