linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Calculating 64-Bit Values
@ 2004-05-13 13:49 Jonas Appel
  2004-05-13 14:30 ` Steven Smith
  0 siblings, 1 reply; 2+ messages in thread
From: Jonas Appel @ 2004-05-13 13:49 UTC (permalink / raw)
  To: linux-c-programming

I hope this is not a really stupid question, but Ive tried some ways
and I'm still not satisfied with my current solution. I have to 
calculate some 64 Bit values, like this:

typedef unsigned long long int64;

int64 val = 0x7c95674beb4000;

the only working way to perform calculation was this:

unsigned int timestamp[2];

timestamp[1] = (unsigned int)((int64)val+0x4324154));
timestamp[0] = (int64)((int64)val+0x4324154)) >> 32;

And printing the value works like this:

printf("Value: %8lx%8lx\n", timestamp[0], timestamp[1]);

Does anyone know a better way to get along with these 64Bit-values?

Thanks in advance,

Jonas


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-05-13 14:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-13 13:49 Calculating 64-Bit Values Jonas Appel
2004-05-13 14:30 ` Steven Smith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).