Re: Porting Java code to D that uses << and >>> operators

2017-05-02 Thread Faux Amis via Digitalmars-d-learn
On 2017-05-02 18:55, TheGag96 wrote: On Tuesday, 2 May 2017 at 07:42:45 UTC, Jacob Carlborg wrote: From that link: "Note that dmd currently does not comply with left to right evaluation of function arguments and AssignExpression". This is something I've never understood. Why doesn't DMD impl

Re: Porting Java code to D that uses << and >>> operators

2017-05-02 Thread Faux Amis via Digitalmars-d-learn
On 2017-05-02 09:42, Jacob Carlborg wrote: On 2017-05-02 01:27, Faux Amis wrote: To me, this [2] suggests otherwise ;) Or am I missing something? [2] https://dlang.org/spec/expression.html#order-of-evaluation From that link: "Note that dmd currently does not comply with left to right evalu

Re: Porting Java code to D that uses << and >>> operators

2017-05-02 Thread TheGag96 via Digitalmars-d-learn
On Tuesday, 2 May 2017 at 07:42:45 UTC, Jacob Carlborg wrote: From that link: "Note that dmd currently does not comply with left to right evaluation of function arguments and AssignExpression". This is something I've never understood. Why doesn't DMD implement the behavior their own language

Re: Porting Java code to D that uses << and >>> operators

2017-05-02 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-05-02 01:27, Faux Amis wrote: To me, this [2] suggests otherwise ;) Or am I missing something? [2] https://dlang.org/spec/expression.html#order-of-evaluation From that link: "Note that dmd currently does not comply with left to right evaluation of function arguments and AssignExpres

Re: Porting Java code to D that uses << and >>> operators

2017-05-01 Thread Era Scarecrow via Digitalmars-d-learn
On Monday, 1 May 2017 at 21:04:15 UTC, bachmeier wrote: On Monday, 1 May 2017 at 18:16:48 UTC, Era Scarecrow wrote: Reminds me... was the unsigned shift >>> ever fixed? What was wrong with it? Doing a broad test I'm seeing an issue with short & byte versions... Course that's probably due t

Re: Porting Java code to D that uses << and >>> operators

2017-05-01 Thread Faux Amis via Digitalmars-d-learn
Not sure if this is still the case. But this [1] suggests that D doesn't have an evaluation order defined but Java does. [1] http://dsource.org/projects/dwt/wiki/Porting#Evaluationorder To me, this [2] suggests otherwise ;) Or am I missing something? [2] https://dlang.org/spec/expression.ht

Re: Porting Java code to D that uses << and >>> operators

2017-05-01 Thread bachmeier via Digitalmars-d-learn
On Monday, 1 May 2017 at 18:16:48 UTC, Era Scarecrow wrote: On Monday, 1 May 2017 at 15:53:41 UTC, Basile B. wrote: It's the same code in D. It extracts consecutive bits in x12 and x13 (and maskxx), put them at the beginning (right shift) and add them. Reminds me... was the unsigned shift >>

Re: Porting Java code to D that uses << and >>> operators

2017-05-01 Thread bachmeier via Digitalmars-d-learn
On Monday, 1 May 2017 at 19:06:36 UTC, Jacob Carlborg wrote: Not sure if this is still the case. But this [1] suggests that D doesn't have an evaluation order defined but Java does. [1] http://dsource.org/projects/dwt/wiki/Porting#Evaluationorder That's good to know but shouldn't be an issue

Re: Porting Java code to D that uses << and >>> operators

2017-05-01 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-05-01 17:45, bachmeier wrote: I'm porting a small piece of Java code into D, but I've run into this: int y1 = ((x12 & MASK12) << 22) + (x12 >>> 9) + ((x13 & MASK13) << 7) + (x13 >>> 24); I have a basic understanding of those operators in both languages, but I can't find a sufficiently d

Re: Porting Java code to D that uses << and >>> operators

2017-05-01 Thread Era Scarecrow via Digitalmars-d-learn
On Monday, 1 May 2017 at 15:53:41 UTC, Basile B. wrote: It's the same code in D. It extracts consecutive bits in x12 and x13 (and maskxx), put them at the beginning (right shift) and add them. Reminds me... was the unsigned shift >>> ever fixed?

Re: Porting Java code to D that uses << and >>> operators

2017-05-01 Thread bachmeier via Digitalmars-d-learn
On Monday, 1 May 2017 at 15:53:41 UTC, Basile B. wrote: It's the same code in D. It extracts consecutive bits in x12 and x13 (and maskxx), put them at the beginning (right shift) and add them. Thanks.

Re: Porting Java code to D that uses << and >>> operators

2017-05-01 Thread Basile B. via Digitalmars-d-learn
On Monday, 1 May 2017 at 15:45:00 UTC, bachmeier wrote: I'm porting a small piece of Java code into D, but I've run into this: int y1 = ((x12 & MASK12) << 22) + (x12 >>> 9) + ((x13 & MASK13) << 7) + (x13 >>> 24); I have a basic understanding of those operators in both languages, but I can't

Porting Java code to D that uses << and >>> operators

2017-05-01 Thread bachmeier via Digitalmars-d-learn
I'm porting a small piece of Java code into D, but I've run into this: int y1 = ((x12 & MASK12) << 22) + (x12 >>> 9) + ((x13 & MASK13) << 7) + (x13 >>> 24); I have a basic understanding of those operators in both languages, but I can't find a sufficiently detailed explanation to tell me how