All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonas Appel <jonas.appel@jonas-appel.de>
To: linux-c-programming@vger.kernel.org
Subject: Calculating 64-Bit Values
Date: Thu, 13 May 2004 15:49:41 +0200	[thread overview]
Message-ID: <1084456108.802075@slbhw0> (raw)

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


             reply	other threads:[~2004-05-13 13:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-13 13:49 Jonas Appel [this message]
2004-05-13 14:30 ` Calculating 64-Bit Values Steven Smith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1084456108.802075@slbhw0 \
    --to=jonas.appel@jonas-appel.de \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.