linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Steven Smith" <sos22@cam.ac.uk>
To: Jonas Appel <jonas.appel@jonas-appel.de>
Cc: linux-c-programming@vger.kernel.org, sos22@srcf.ucam.org
Subject: Re: Calculating 64-Bit Values
Date: Thu, 13 May 2004 15:30:47 +0100	[thread overview]
Message-ID: <20040513143047.GA5370@archibold.chu.cam.ac.uk> (raw)
In-Reply-To: <1084456108.802075@slbhw0>

[-- Attachment #1: Type: text/plain, Size: 631 bytes --]

> typedef unsigned long long int64;
> 
> int64 val = 0x7c95674beb4000;
Try:

int64 val = 0x7c95674beb4000ll;

gcc won't generate a long long constant unless you explictly tell it
to; it tries to stuff the whole thing into 32 bits, which doesn't
really work.

Incidentally, you might want to pick a different name for your typedef
-- int64 is usually signed.

> And printing the value works like this:
> 
> printf("Value: %8lx%8lx\n", timestamp[0], timestamp[1]);
printf("Value: %llx", timestamp);

should work.  You may need %qx instead of %llx on some really old
systems, or conceivably %Lx.

Steven Smith.

[-- Attachment #2: Type: application/pgp-signature, Size: 187 bytes --]

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

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

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=20040513143047.GA5370@archibold.chu.cam.ac.uk \
    --to=sos22@cam.ac.uk \
    --cc=jonas.appel@jonas-appel.de \
    --cc=linux-c-programming@vger.kernel.org \
    --cc=sos22@srcf.ucam.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 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).