On Tuesday, 18 December 2018 at 20:33:43 UTC, Rainer Schuetze
wrote:
On 14/12/2018 02:56, Steven Schveighoffer wrote:
On 12/13/18 7:16 PM, Michelle Long wrote:
byte x = 0xF;
ulong y = x >> 60;
Surely you meant x << 60? As x >> 60 is going to be 0, even
with a ulong.
It doesn't work as
On 14/12/2018 02:56, Steven Schveighoffer wrote:
> On 12/13/18 7:16 PM, Michelle Long wrote:
>> byte x = 0xF;
>> ulong y = x >> 60;
>
> Surely you meant x << 60? As x >> 60 is going to be 0, even with a ulong.
It doesn't work as intuitive as you'd expect:
void main()
{
int x = 256;
On Fri, 14 Dec 2018 00:16:51 +, Michelle Long wrote:
> byte x = 0xF;
> ulong y = x >> 60;
"Error: shift by 60 is outside the range 0..31"
This is the result of integer promotion rules. Change the 30 to a 60 and
it works, and the result is, as you would expect, 0.
> I thought D required
On Friday, 14 December 2018 at 02:17:20 UTC, Jonathan M Davis
wrote:
On Thursday, December 13, 2018 6:56:33 PM MST Steven
Schveighoffer via Digitalmars-d-learn wrote:
On 12/13/18 7:16 PM, Michelle Long wrote:
> I've noticed the compiler is not throwing up errors and
> warnings like it used to:
On Thursday, December 13, 2018 6:56:33 PM MST Steven Schveighoffer via
Digitalmars-d-learn wrote:
> On 12/13/18 7:16 PM, Michelle Long wrote:
> > I've noticed the compiler is not throwing up errors and warnings like it
> > used to:
> >
> > I thought D required breaks for cases? Seems it doesn't
On 12/13/18 7:16 PM, Michelle Long wrote:
byte x = 0xF;
ulong y = x >> 60;
Surely you meant x << 60? As x >> 60 is going to be 0, even with a ulong.
Does not compute the proper value.
It seems that the shift amount is wrapped. My code is more complex. The
code above does give an error. I
I do not understand you?
What is wrong? It works ok.
https://run.dlang.io/is/ZFf0FQ
What do you mean by D required breaks for cases?
On Fri, Dec 14, 2018 at 1:20 AM Michelle Long via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> byte x = 0xF;
> ulong y = x >> 60;
>
> Does
byte x = 0xF;
ulong y = x >> 60;
Does not compute the proper value.
It seems that the shift amount is wrapped. My code is more
complex. The code above does give an error. I am using the code
in a template. If I change x to ulong it works as expected.
I've noticed the compiler is not