develooper Front page | perl.perl5.porters | Postings from April 2007

RE: [PATCH] VC6 compatibility issue with shared.xs

Thread Previous | Thread Next
From:
Jan Dubois
Date:
April 9, 2007 14:02
Subject:
RE: [PATCH] VC6 compatibility issue with shared.xs
Message ID:
008101c77aea$4086cae0$c19460a0$@com
On Mon, 09 Apr 2007, Jerry D. Hedden wrote:
> It would probably be better to do the division first:
>
>     rel = (abs * 1000.) - (now.i64 / 10000) - EPOCH_BIAS);
>
> Does this require any casting, or will it just work?

You are missing a '(' in the expression above, but it will also
still require a cast, as eventually you have to convert the
"unsigned __int64" that is the result of the division to a double
to perform the subtraction.

You may also need a Const64() macro to turn 10000 into 10000LL (GCC) or
10000i64 (VC6) (see Time::HiRes), but I think my simple cast may turn
out to be, uh, simpler. I would not worry about now.i64 having a non-zero
high-bit. :)

Cheers,
-Jan

> On 4/9/07, Jan Dubois <jand@activestate.com> wrote:
> > VC6 without the "Visual C++ Processor Pack" doesn't support
> > conversion from unsigned __int64 to double:
> >
> >   error C2520: conversion from unsigned __int64 to double not
> >   implemented, use signed __int64
> >
> > I would prefer if core Perl module could be compiled without the
> > Processor Pack installed, as it is not available for all versions
> > and service pack levels of VC6.
> >
> > The attached patch just does an opportunistic cast into signed
> > __int64. But maybe you would prefer to change the definition of
> > now.i64 to be signed instead...
> >
> > Cheers,
> > -Jan
> >
> > --- ext/threads/shared/shared.xs.orig Mon Mar 19 09:43:55 2007 +++
> > ext/threads/shared/shared.xs Mon Apr 09 12:31:24 2007 @@ -569,7
> > +569,7 @@ GetSystemTimeAsFileTime(&now.ft);
> >
> >      /* Relative time in milliseconds */
> > -    rel = (abs * 1000.) - (((double)now.i64 / 10000.) -
> >      EPOCH_BIAS);
> > +    rel = (abs * 1000.) - (((double)(__int64)now.i64 / 10000.) -
> >      EPOCH_BIAS);
> >
> >                          if (rel <= 0.0) {
> >                             return (0);



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About