Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.


#1 2011-04-15 05:16:27

New member
Registered: 2011-01-13
Posts: 3

Invalid Operand for Shift Operator (or an internal compiler error :D)

Yo doods.

I've been trying to compile this borrowed code in GBDK with no success.

Note the Sar inline definition
#define Sar(a,b) (((a)<0) ? -((-a)>>(b)) : ((a)>>(b)))

Later on when I use it with say, a long integer and an unsigned 8bit integer, it throws a warning for the variable types used (regardless of what variable type they are, having tried many combinations) and an error in the Sar function, specifically in the -((-a)>>(b)) part. "Invalid Operand for Shift Operator".

So I wrote the inline definition out as a full function, same error. I changed the offending line of code to return (a)>>(b);, and the compiler has a hissy fit/internal error in "gen.c" line 349 : code generation internal error.

What on earth have I dont wrong? hmm



Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson