fn bit_reverse(num: Uint256, num_of_bits: usize) -> usize {
	assert!( num_of_bits == 256 || num < prime_field::fpow( &uint256_ops::get_uint256("2"), &uint256_ops::from_usize(num_of_bits) ) ); // Make sure number size is correctly specified

	let mut r = 0;
	let mut n = uint256_ops::to_usize(&num);
	for _ in 0..num_of_bits {
		r = (r * 2) | (n % 2);
		n = n / 2;
	}

	return r;
}
/*
	Returns the bit reversal of num assuming it has the given number of bits.
	For example, if we have numberOfBits = 6 and num = (0b)1101 == (0b)001101,
	the function will return (0b)101100.
*/
Returns the bit reversal of num assuming it has the given number of bits.
Returns the bit reversal of num assuming it has the given number of bits .
fn bit_reverse(num: Uint256, num_of_bits: usize) -> usize {
	assert!( num_of_bits == 256 || num < prime_field::fpow( &uint256_ops::get_uint256("2"), &uint256_ops::from_usize(num_of_bits) ) ); // Make sure number size is correctly specified
	let mut r = 0;
	let mut n = uint256_ops::to_usize(&num);
	for _ in 0..num_of_bits {
		r = (r * 2) | (n % 2);
		n = n / 2;
	}
	return r;
}
fn bit_reverse ( num : Uint256 , num_of_bits : usize ) -> usize { assert ! ( num_of_bits 256 num prime_field fpow ( uint256_ops get_uint256 ( " " ) uint256_ops from_usize ( num_of_bits ) ) ) ; // Make sure number size is correctly specified let mut r = 0 ; let mut n = uint256_ops :: to_usize ( & num ) ; for _ in 0 .. num_of_bits { r = ( r * 2 ) | ( n % 2 ) ; n = n / 2 ; } return r ; }
Returns the bit reversal of num assuming it has the given number of bits.
Returns the bit reversal of num assuming it has the given number of bits .
num
Uint256
num_of_bits
usize
num
Uint256
num_of_bits
usize