tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Tinycc-devel] win32 port


From: TK
Subject: RE: [Tinycc-devel] win32 port
Date: Thu, 14 Oct 2004 09:43:31 -0700

Yes you are right.  Although it should work.  Any compiler I ever used
automatically uses a type that is large enough to contain the constant.  The
only time I have found a need for a specification/cast is when the constant
is smaller than the desired operation.  Ironically it seems this is exactly
what tcc is doing here.

Another approach might be to sidestep the issue with:

        if (n >> 32)

TK

-----Original Message-----
From: address@hidden
[mailto:address@hidden Behalf Of
Philippe Ribet
Sent: Thursday, October 14, 2004 2:24 AM
To: address@hidden
Subject: Re: [Tinycc-devel] win32 port


TK wrote:


<         unsigned long long n, n1;
---
>         uint64_t n, n1;


It's ok. BTW, Fabrice, if you're intrested, I can offer you macro which
defines intxx_t types for compilers who don't defines it.

<         if ((n & 0xffffffff00000000LL) != 0) {
---
>         if ((n & ((int64_t)0xffffffff00000000)) != 0) {

This code is wrong. You try to cast into int64_t in order to get some 64
bits value, this means you consider you have a 32 bits one. If the constant
is 32 bits, this means you lost half the bits and the cast won't recover
them.

The good definition is: if ((n & INT64_C(0xffffffff00000000)) != 0) {

The definitions I proposed defines INTxx_C too for old compilers which
use their own syntax.

    Best regards,

--
Philippe Ribet



                         The README file said
              "Requires Windows 95, NT 4.0, or better."
                    So... I installed it on Linux!



_______________________________________________
Tinycc-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/tinycc-devel





reply via email to

[Prev in Thread] Current Thread [Next in Thread]