LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   long long long: Too long for GCC (https://www.linuxquestions.org/questions/programming-9/long-long-long-too-long-for-gcc-832696/)

Kenny_Strawn 09-16-2010 08:34 PM

long long long: Too long for GCC
 
How come I get this error described in the title and is there any way to assign a 128-bit hexadecimal value to a variable? If so, what libraries do you need to enable it? And if you do need libraries, are they in the Ubuntu repositories?

14moose 09-16-2010 09:49 PM

Hi -

The thing you're looking for is "big numbers" (aka "bignum"). Here's a good link for GCC:

http://dl.fefe.de/bignum.pdf

Interestingly, you *might* have an "__int128" type with your GCC compiler - check it out.

Otherwise, the above link (or a Google search on "C/C++ bignum") might point you in the right direction.

JohnGraham 09-17-2010 03:38 AM

Also, the GNU Multiple Precision Library is popular for arbitrarily large numbers.

Kenny_Strawn 09-17-2010 07:10 AM

Yeah... Now how is the 'bignum_st' struct initialized?

Oh, and I also ran into another error that apparently the 'bignum.pdf' file didn't take into account:

Code:

error: BN_ULONG doesn't name a type
Now how is that "BN_ULONG" type declared? Is it done with #define or something?

Kenny_Strawn 09-17-2010 07:39 PM

Anyone?

14moose 09-18-2010 01:14 AM

Hi -

1. You'd have to define BN_LONG yourself - presumably with a typdef.

2. I didn't mean the article as a complete, prêt-à-porter solution.
I merely thought it would give you useful pointers for developing your own solution. More like an "algorithm", than code you could simply cut/paste.

3. If you want an "off the rack" solution, however, I'd encourage you to consider GMP (as others have also recommended).

You might also want to consider Tom's Math library (also, along with GMP, mentioned in the article I cited):

http://www.freshports.org/math/libtommath/
http://libtom.org


All times are GMT -5. The time now is 07:24 PM.