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

reverse_bits_limited helper for polynomial-commitments-sampling.md #3575

Open
dankrad opened this issue Jan 11, 2024 · 1 comment
Open

reverse_bits_limited helper for polynomial-commitments-sampling.md #3575

dankrad opened this issue Jan 11, 2024 · 1 comment

Comments

@dankrad
Copy link
Contributor

dankrad commented Jan 11, 2024

There's potential for a new helper function, which doesn't add much complexity, that could improve efficiency in a few spots, like here. Something like the following method might be a useful addition. Rather than BRP the list of roots, you can just compute the index/indices that you need.

def reverse_bits_limited(num_bits: int, value: int):
    reversed_bits = 0
    for _ in range(32): # 32-bit value
        reversed_bits = (reversed_bits << 1) | (value & 1)
        value >>= 1
    unused_bit_len = 32 - int(math.log2(num_bits))
    return reversed_bits >> unused_bit_len

Originally posted by @jtraglia in #3557 (comment)

@dankrad dankrad changed the title There's potential for a new helper function, which doesn't add much complexity, that could improve efficiency in a few spots, like here. Something like the following method might be a useful addition. Rather than BRP the list of roots, you can just compute the index/indices that you need. reverse_bits_limited helper for polynomial-commitments-sampling.md Jan 11, 2024
@jtraglia
Copy link
Member

I will try to make a PR for this later! This isn't a high priority addition IMO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants