LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-16-2010, 08:34 PM   #1
Kenny_Strawn
Senior Member
 
Registered: Feb 2010
Location: /usa/ca/orange_county/lake_forest
Distribution: ArchBang, Google Android 2.1 + Motoblur (on Motortola Flipside), Google Chrome OS (on Cr-48)
Posts: 1,791
Blog Entries: 62

Rep: Reputation: 56
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?
 
Old 09-16-2010, 09:49 PM   #2
14moose
Member
 
Registered: May 2010
Posts: 83

Rep: Reputation: Disabled
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.
 
Old 09-17-2010, 03:38 AM   #3
JohnGraham
Member
 
Registered: Oct 2009
Posts: 467

Rep: Reputation: 139Reputation: 139
Also, the GNU Multiple Precision Library is popular for arbitrarily large numbers.
 
Old 09-17-2010, 07:10 AM   #4
Kenny_Strawn
Senior Member
 
Registered: Feb 2010
Location: /usa/ca/orange_county/lake_forest
Distribution: ArchBang, Google Android 2.1 + Motoblur (on Motortola Flipside), Google Chrome OS (on Cr-48)
Posts: 1,791

Original Poster
Blog Entries: 62

Rep: Reputation: 56
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?

Last edited by Kenny_Strawn; 09-17-2010 at 07:16 AM.
 
Old 09-17-2010, 07:39 PM   #5
Kenny_Strawn
Senior Member
 
Registered: Feb 2010
Location: /usa/ca/orange_county/lake_forest
Distribution: ArchBang, Google Android 2.1 + Motoblur (on Motortola Flipside), Google Chrome OS (on Cr-48)
Posts: 1,791

Original Poster
Blog Entries: 62

Rep: Reputation: 56
Anyone?
 
Old 09-18-2010, 01:14 AM   #6
14moose
Member
 
Registered: May 2010
Posts: 83

Rep: Reputation: Disabled
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
 
  


Reply

Tags
long+long+long



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is not 'long long' of 8 bytes in gcc? ishandutta2007 Programming 12 01-12-2010 11:00 PM
Is not 'long long' of 8 bytes in gcc? ishandutta2007 Programming 1 01-12-2010 08:40 AM
LXer: This week at LWN: Long discussions about long names LXer Syndicated Linux News 0 05-19-2009 10:50 PM
Long standing USB problem with XP & Linux...long cbjhawks Linux - Hardware 4 02-23-2009 08:32 AM
long filename & long directory tree slack66 Slackware 1 09-20-2006 09:56 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration