mpz_tstbit is limited ?
Wed, 25 Dec 2002 23:30:30 -0500
>>>The definition of the mpz_tstbit function is:
>>>int mpz_tstbit (mpz_t op, unsigned long int bit_index)
>>> Why not:
>>>bool mpz_tstbit (mpz_t op, unsigned long int bit_index)
>>Because bool is a c++ specific keyword and gmp is built to be used with
>>standatd 'c'. Standard 'c' doesn't know about 'bool'.
>Yes. I imagine that the futur C++ interface method will return bool 8->
>>> Why not:
>>>int mpz_tstbit (mpz_t op, mpz_t bit_index)
>>Because it wouldn't make much sence to test bits larger than a long int.
>>This would be a test un a number that is 4 bilion bits wide. So, for
>>speed concert, we use a unsigned long.
>Hmmmmm ... 22^32 is really a wide number and probability to need it is
>really poor and i understand the speed concert.
> But imagine we use mpz_t as a set of bits (or a bit string), so
>the max size of the set is 4,294,967,296 bits, so only 512Mo.
>Today, is it enough ????? GMP is very interesting to put index in mpz_t
>for big bit string.
>a) create a other new function which test if the index of bit is less
>than 232 (fast test ?) and so call the actual function and do other if not.
>b) wait for 64 bits processor and use long long (or quad) block.
>In case of a), what would be the test ? Is it a fast one ?
>What do you think about this ?
Well, you can ask for the mpz_t version to be added. Mr K. Ryde would
probably be the best person who could answer you on this :-) Although,
2^2^32 is not really something that we would see every day! There's a
number of functions that use only unsigned long like exponentiation
The new MSN 8: smart spam protection and 3 months FREE*.