64 bits integer
How can we do to manipulate integer higher than 32 bits in linux ?
Does exist some system call (or another library), that allow us to do something like as following ?
int64 x;
x = atoi64("12345678901234567890");
char x[21];i64toa(x, sizeof(x));
Thanks,
Luciano
Hi !
You can use the type "long long" to define 64 bit data in gcc, use strtoll() atoll() to parse a string, and all the *printf functions has support for 64 bit values also.
Mikael
----- Original Message -----
From: "Luciano Moreira - igLnx" <[email protected]>
To: "linux-c-programming" <[email protected]>
Sent: Wednesday, November 10, 2004 2:30 AM
Subject: 64 bits integer
Quoted 11 lines
How can we do to manipulate integer higher than 32 bits in linux ?
Does exist some system call (or another library), that allow us to do something like as following ?
int64 x;
x =atoi64("12345678901234567890");char x[21];
i64toa(x, sizeof(x));
Quoted 6 lines
Thanks,
Luciano
-
To unsubscribe from this list: send the line "unsubscribe
linux-c-programming" in
Quoted 2 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, 2004-11-09 22:30:57 -0300, Luciano Moreira - igLnx <[email protected]> wrote in message <[email protected]>:
Quoted 10 lines
How can we do to manipulate integer higher than 32 bits in linux ?
Does exist some system call (or another library), that allow us to do something like as following ?
int64 x;
x =atoi64("12345678901234567890");char x[21];
i64toa(x, sizeof(x));
As pointed out, gcc uses a 64 bit wide integer as long long. If you really require exactly a 64 bit integer, you'd declare it as uint64_t (which is from stdint.h). Also, printf() etc will handle it just fine.
If you, however, require integers of at least 64 bit of size (with an open end), you need to use any of the libraries that offers an implementation of that. This is beyond the scope of C. I've just recently used libgcryp11 for something like that (actually, the large integers are afterwards used to verify a POS printer's fiscal journal), but there are other libs for it, too.
MfG, JBG
Signature · 4 lines
Jan-Benedict Glaw [email protected] . +49-172-7608481 _ O _ "Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg _ _ O fuer einen Freien Staat voll Freier Bürger" | im Internet! | im Irak! O O O ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));