public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mihnea Balta <dark_lkml@mymail.ro>
To: Adrian Sandor <aditsu@yahoo.com>, gcc-help@gcc.gnu.org
Subject: Re: how to make a long long
Date: Thu, 20 Feb 2003 09:05:00 -0000	[thread overview]
Message-ID: <200302201103.14663.dark_lkml@mymail.ro> (raw)
In-Reply-To: <20030220085624.11949.qmail@web40309.mail.yahoo.com>

On Thursday 20 February 2003 10:56, Adrian Sandor wrote:
> Wich is the proper way to make an unsigned long long
> from two unsigned ints (high and low dwords) without
> too many conversions and calculations?

Choose whatever you like:

int main(){
    union{
        struct{
            unsigned long long a:32;
            unsigned long long b:32;
        } gigi;
        unsigned long long l;
    } toto;
    unsigned long long l;
    unsigned long long referenceval;

    toto.gigi.a = 0xFFFFFFFF;
    toto.gigi.b = 0xFFFFFFFF;
    l = 0xFFFFFFFF;
    l <<= 32;
    l += 0xFFFFFFFF;
    memset(&referenceval, 0xFF, sizeof(referenceval));
    printf("%llu\n%llu\n%llu\n", toto.l, l, referenceval);
    return 0;
}

>
> thanks
>
> Adrian
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Tax Center - forms, calculators, tips, more
> http://taxes.yahoo.com/
>
> ------------------------------------------------------------------------
> P.S. Stiai ca s-a lansat www.FreeSMS.ro ?

  reply	other threads:[~2003-02-20  9:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-20  8:56 Adrian Sandor
2003-02-20  9:05 ` Mihnea Balta [this message]
2003-02-20  9:58   ` Adrian Sandor
2003-02-20 10:24     ` Mihnea Balta
2003-02-20 11:02 ` Sebastian Huber
2003-02-20 11:40   ` Mihnea Balta
     [not found] <1045823803.20501.ezmlm@gcc.gnu.org>
2003-02-22 15:44 ` Adrian Sandor
2003-02-22 16:30 Sebastian Huber
2003-02-22 21:37 ` LLeweLLyn Reese
2003-02-22 22:13   ` Sebastian Huber
2003-02-24  5:51     ` LLeweLLyn Reese

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=200302201103.14663.dark_lkml@mymail.ro \
    --to=dark_lkml@mymail.ro \
    --cc=aditsu@yahoo.com \
    --cc=gcc-help@gcc.gnu.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 read-only IMAP folder(s) and NNTP newsgroup(s).