Construction From vector<char> ?

Marc Glisse marc.glisse at normalesup.org
Wed Aug 13 23:31:00 CEST 2008


On Wed, 13 Aug 2008, Robert Evans wrote:

> Sorry, I am not explaining myself well.  What we have is not a vector
> containing the characters (i.e. ascii) representing a number, but the
> actual hex bytes.  For example, we might have a 4 byte array containing
> [0x31 0x32 0x33 0x34].  For us this is NOT the number "1234" but the
> number 0x31323334 or in decimal 825373492.  I supposed we should have
> used the name vector<unsigned short> but someone used vector<char> which
> is a bit  misleading.

Wow ok. The most confusing thing is that the smallest the type you put in 
vector, the slower the computations on that number will be. I just 
couldn't believe that someone would use char there...

Then what you are looking for is most likely mpz_import/mpz_export.

-- 
Marc Glisse


More information about the gmp-discuss mailing list