www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - GtkD compile failed. shift by 32

reply 1100110 <10equals2 gmail.com> writes:
http://svn.dsource.org/projects/gtkd/branches/070125merge/gtkD/src/gdk/Color.d


uint getValue()
{
	return (gdkColor.red <<32) | (gdkColor.green << 16) | (gdkColor.blue);
}


Just browsing through the source it looks like gtkColor.red is a ushort.
I get this error.

dmd -O -m64 -Isrc -c src/gdk/Pixbuf.d -ofsrc/gdk/Pixbuf.o
src/gdk/Color.d(231): Error: shift by 32 is outside the range 0..31
make: *** [src/gdk/Color.o] Error 1
make: *** Waiting for unfinished jobs....
==> ERROR: A failure occurred in build().

I get that exact same message no matter which compiler I use.

Does any

-- 
Using Opera's rev...Shutit Opera.
Firefox is catching up. Apparently their machines ran
out of RAM too.
Jun 10 2012
next sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Sunday, June 10, 2012 20:21:29 1100110 wrote:
 http://svn.dsource.org/projects/gtkd/branches/070125merge/gtkD/src/gdk/Color
 .d
 
 
 uint getValue()
 {
 	return (gdkColor.red <<32) | (gdkColor.green << 16) | (gdkColor.blue);
 }
 
 
 Just browsing through the source it looks like gtkColor.red is a ushort.
 I get this error.
 
 dmd -O -m64 -Isrc -c src/gdk/Pixbuf.d -ofsrc/gdk/Pixbuf.o
 src/gdk/Color.d(231): Error: shift by 32 is outside the range 0..31
 make: *** [src/gdk/Color.o] Error 1
 make: *** Waiting for unfinished jobs....
 ==> ERROR: A failure occurred in build().
 
 I get that exact same message no matter which compiler I use.
 
 Does any
I take it that part of you post got cut off? In either case, * ulong can only be shifted by up to 63 bits * uint can only be shifted by up to 31 bits * ushort can only be shifted by up to 15 bits * ubyte can only be shifted by up to 7 bits Any code which attempts to shift by more than that is wrong. If you want to shift a value by the number of bits in its type, you might as well just use 0. If gtkD is attempting to shift by more than is legal, then it has a bug. - Jonathan M Davis
Jun 10 2012
prev sibling parent reply Mike Wey <mike-wey example.com> writes:
On 06/11/2012 03:21 AM, 1100110 wrote:
 http://svn.dsource.org/projects/gtkd/branches/070125merge/gtkD/src/gdk/Color.d



 uint getValue()
 {
      return (gdkColor.red <<32) | (gdkColor.green << 16) | (gdkColor.blue);
 }


 Just browsing through the source it looks like gtkColor.red is a ushort.
 I get this error.

 dmd -O -m64 -Isrc -c src/gdk/Pixbuf.d -ofsrc/gdk/Pixbuf.o
 src/gdk/Color.d(231): Error: shift by 32 is outside the range 0..31
 make: *** [src/gdk/Color.o] Error 1
 make: *** Waiting for unfinished jobs....
 ==> ERROR: A failure occurred in build().

 I get that exact same message no matter which compiler I use.

 Does any
This was a bug in GtkD, getValue needs to return a ulong. The fix has been in the git/svn repo for quite a while now ;). -- Mike Wey
Jun 11 2012
parent 1100110 <10equals2 gmail.com> writes:
On Mon, 11 Jun 2012 14:05:05 -0500, Mike Wey <mike-wey example.com> wrote:

 On 06/11/2012 03:21 AM, 1100110 wrote:
 http://svn.dsource.org/projects/gtkd/branches/070125merge/gtkD/src/gdk/Color.d



 uint getValue()
 {
      return (gdkColor.red <<32) | (gdkColor.green << 16) |  
 (gdkColor.blue);
 }


 Just browsing through the source it looks like gtkColor.red is a ushort.
 I get this error.

 dmd -O -m64 -Isrc -c src/gdk/Pixbuf.d -ofsrc/gdk/Pixbuf.o
 src/gdk/Color.d(231): Error: shift by 32 is outside the range 0..31
 make: *** [src/gdk/Color.o] Error 1
 make: *** Waiting for unfinished jobs....
 ==> ERROR: A failure occurred in build().

 I get that exact same message no matter which compiler I use.

 Does any
This was a bug in GtkD, getValue needs to return a ulong. The fix has been in the git/svn repo for quite a while now ;).
Yeah, the README for GtkD said to use the packages from the dsource site... Which are the ones that have that bug. Maybe that should not be stated there... Thanks for the info guys! I downloaded from the github and everything works nicely now. Sorry for the stupid question, probably should have just slept instead. =P -- Using Opera's revolutionary email client: http://www.opera.com/mail/
Jun 14 2012