digitalmars.D.learn - What ?
- matovitch (7/7) Mar 30 2015 Hi again again,
- Vladimir Panteleev (4/11) Mar 30 2015 ulong, yes, but 1 is of type int.
- matovitch (3/19) Mar 30 2015 Arf ! Safety. Danke !
- Brian Schott (4/11) Mar 30 2015 The problem is that `1` isn't a ulong. The reason for this is
- bearophile (7/9) Mar 30 2015 I suggest a more explicit:
Hi again again, ulong u = 1 << 63; Raise : Error: shift by 63 is outside the range 0..31 This is a bug isn't it, the ulong are supposed to be on 64 bits ? I guess it's time I go to bed. Have a nice night !
Mar 30 2015
On Monday, 30 March 2015 at 22:34:00 UTC, matovitch wrote:Hi again again, ulong u = 1 << 63; Raise : Error: shift by 63 is outside the range 0..31 This is a bug isn't it, the ulong are supposed to be on 64 bits ? I guess it's time I go to bed. Have a nice night !ulong, yes, but 1 is of type int. Correct code: ulong u = 1L << 63;
Mar 30 2015
On Monday, 30 March 2015 at 22:34:55 UTC, Vladimir Panteleev wrote:On Monday, 30 March 2015 at 22:34:00 UTC, matovitch wrote:Arf ! Safety. Danke !Hi again again, ulong u = 1 << 63; Raise : Error: shift by 63 is outside the range 0..31 This is a bug isn't it, the ulong are supposed to be on 64 bits ? I guess it's time I go to bed. Have a nice night !ulong, yes, but 1 is of type int. Correct code: ulong u = 1L << 63;
Mar 30 2015
On Monday, 30 March 2015 at 22:34:00 UTC, matovitch wrote:Hi again again, ulong u = 1 << 63; Raise : Error: shift by 63 is outside the range 0..31 This is a bug isn't it, the ulong are supposed to be on 64 bits ? I guess it's time I go to bed. Have a nice night !The problem is that `1` isn't a ulong. The reason for this is probably C compatibility. Do this instead: ulong u = 1L << 63;
Mar 30 2015
Brian Schott:Do this instead: ulong u = 1L << 63;I suggest a more explicit: ulong u = 1UL << 63; Alternative: ulong u = 2UL ^^ 63; Bye, bearophile
Mar 30 2015