/// Convert an unsigned number into the corresponding field element.  This is so
/// that we can make tests on Scalar that are easily understandable to humans by
/// using the integer equivalents.
///
/// This makes no assumptions about the field representation, so construction is
/// only through the trait API.  This is because, in this context, correctness
/// not speed is the primary goal.
Convert an unsigned number into the corresponding field element.  This is so
that we can make tests on Scalar that are easily understandable to humans by
using the integer equivalents.

This makes no assumptions about the field representation, so construction is
only through the trait API.  This is because, in this context, correctness
not speed is the primary goal.
Convert an unsigned number into the corresponding field element . This is so that we can make tests on Scalar that are easily understandable to humans by using the integer equivalents . This makes no assumptions about the field representation so construction is only through the trait API . This is because in this context correctness not speed is the primary goal .
pub fn uint_to_fr(num: u32) -> Scalar {
    let mut num = num;
    let mut power = Scalar::one();
    let mut ans = Scalar::zero();
    while num != 0 {
        if (num & 1) != 0 {
            ans += power;
        }
        power = power.double();
        num >>= 1;
    }
    ans
}
pub fn uint_to_fr ( num : u32 ) -> Scalar { let mut num = num ; let mut power = Scalar :: one ( ) ; let mut ans = Scalar :: zero ( ) ; while num != 0 { if ( num & 1 ) != 0 { ans += power ; } power = power . double ( ) ; num >>= 1 ; } ans }
Convert an unsigned number into the corresponding field element.
Convert an unsigned number into the corresponding field element .
num
u32