public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* 64 bit assignment on a 32 bit platform
@ 2007-10-29 10:15 kum
  2007-10-29 10:16 ` Andrew Haley
  2007-10-29 11:08 ` Rask Ingemann Lambertsen
  0 siblings, 2 replies; 7+ messages in thread
From: kum @ 2007-10-29 10:15 UTC (permalink / raw)
  To: gcc-help

Hi,

UINT64 a64; // UINT64 has been typedefed as long long unsigned int
UINT32 a32, b32;
a32 = x; // some value
b32 = y; // some value

a64 = a32 * b32;
a64 += a32 + b32;

Is it necessary to type-cast both a32 and b32 to yield correct 64 bit
results? Without casting, I find that addition (even if the result
overflows) works while the multiplication does not. Is there a
compiler option to make this work without casting? I am using gcc
4.1.1 on an xscale platform.

Thank you all,
kumaresh

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

end of thread, other threads:[~2007-10-29 11:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-29 10:15 64 bit assignment on a 32 bit platform kum
2007-10-29 10:16 ` Andrew Haley
2007-10-29 10:25   ` kum
2007-10-29 10:39     ` Andrew Haley
2007-10-29 10:40       ` kum
2007-10-29 11:08 ` Rask Ingemann Lambertsen
2007-10-29 15:40   ` kum

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).