-
-
Notifications
You must be signed in to change notification settings - Fork 667
convert evalu8.c to evalu8.d #8322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thanks for your pull request, @WalterBright! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "master + dmd#8322" |
|
Building on Appveyor fails because the D part assumes |
|
Another possibility may be to just convert bcomplex.c to D as well. |
|
Affected functions seem to be |
|
Another option is to use |
|
Since it'll all be converted to D anyway, I figured might as well go ahead and convert bcomplex.c to D in this PR. |
9a1673f to
f9e5f9c
Compare
|
Appveyor failures: which have nothing to do with this PR. @rainers what's going on? |
680a3cd to
e9c315a
Compare
|
@rainers are you able to replicate the AppVeyor failures? I can't on my machine. |
Making that change causes semaphoreci to fail with: |
src/dmd/e2ir.d
Outdated
| e.EV.Vcldouble.re = re; | ||
| e.EV.Vcldouble.im = im; | ||
| e.EV.Vcldouble.re = cast(real)re; | ||
| e.EV.Vcldouble.im = cast(real)im; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cast is no longer necessary and is harmful to the LDC build, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, gone
src/dmd/backend/evalu8.d
Outdated
| * instead of the soft long double ones. | ||
| */ | ||
|
|
||
| extern (D) real el_toldoubled(elem *e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, still more uses of real instead of targ_ldouble...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/dmd/backend/evalu8.d
Outdated
| */ | ||
| version (CRuntime_Microsoft) | ||
| { | ||
| extern (D) private real _modulo(real x, real y) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the casts should go into this function instead of the call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all right
| #include "global.h" | ||
| #include "el.h" | ||
| #include "type.h" | ||
| version (SPP) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW: no module name here? (I won't object to module names without package if that's that's how you want to do it ;-) )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No imports of it yet, I'll probably worry about that when imports happen. Right now, I just want to get it to work :-)
|
Still too many uses of |
|
Yes, I could use your help. I'm mostly just floundering about on these platforms I have little knowledge of. |
Done. Now let's see the other platforms complain... |
|
This failed because comparison of two |
|
It's all green and ready to pull! Thanks @rainers for your invaluable help. ping @JinShil @wilzbach @jacob-carlborg ? |
| { | ||
| r = y.re / y.im; | ||
| den = y.im + r * y.re; | ||
| q.re = cast(float)((x.re * r + x.im) / den); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translation looks good, but I don't understand why the casts to float and double in this file are needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they make it clearer what is happening
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and the casts are necessary if targ_ldouble resolves to longdouble_soft, as there is no implicit conversion to float/double then.
|
Also, I see an obvious opportunity for templated code here (may even remove the need for the casts), but I understand if you want to keep the code easy to cross-reference to the C implementation. |
wilzbach
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
| * Copyright: public domain | ||
| * License: public domain | ||
| * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/backend/bcomplex.d, backend/_bcomplex.d) | ||
| * Source: $(DMDSRC backend/_bcomplex.d) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI underscore escaping is no longer needed. We enabled the opt-out about two months ago.
See: dlang/dlang.org#2307
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also last year you made a point of using absolute links here as they are clickable (see #7030).
Though I was a fan of DMDSRC, so I don't mind ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it should be the full version.
| case TYenum: | ||
| #if !MARS | ||
| case TYmemptr: | ||
| #endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this result in a version(MARS){} else { ... } ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided that having too many version statements was clutter, and so removed the ones that weren't really necessary.
| assert((statusFE() & 0x3800) == 0); | ||
| assert(e && EOP(e)); | ||
| op = e->Eoper; | ||
| assert(e && !OTleaf(e.Eoper)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not define EOP or EBIN as a function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think those macros paid off.
|
It also appears bcomplex.c was not deleted in this PR. Shouldn't it be? |
Yes: |
No description provided.