Possible fix for big-endian bug

git-svn-id: http://picoc.googlecode.com/svn/trunk@371 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
zik.saleeba 2009-11-03 20:40:35 +00:00
parent 274f21fdbc
commit 2e07f89194
2 changed files with 10 additions and 4 deletions

View file

@ -187,11 +187,19 @@ int ExpressionAssignInt(struct ParseState *Parser, struct Value *DestValue, int
ProgramFail(Parser, "can't assign to this"); ProgramFail(Parser, "can't assign to this");
if (After) if (After)
Result = DestValue->Val->Integer; Result = ExpressionCoerceInteger(DestValue);
else else
Result = FromInt; Result = FromInt;
DestValue->Val->Integer = FromInt; switch (DestValue->Typ->Base)
{
case TypeInt: DestValue->Val->Integer = FromInt; break;
case TypeShort: DestValue->Val->ShortInteger = (short)FromInt; break;
case TypeChar: DestValue->Val->Character = (unsigned char)FromInt; break;
case TypeUnsignedInt: DestValue->Val->UnsignedInteger = (unsigned int)FromInt; break;
case TypeUnsignedShort: DestValue->Val->UnsignedShortInteger = (unsigned short)FromInt; break;
default: break;
}
return Result; return Result;
} }

View file

@ -170,11 +170,9 @@ union AnyValue
struct ParseState Parser; struct ParseState Parser;
struct ValueType *Typ; struct ValueType *Typ;
struct FuncDef FuncDef; struct FuncDef FuncDef;
#ifndef NO_FP #ifndef NO_FP
double FP; double FP;
#endif #endif
void *NativePointer; /* unsafe native pointers */ void *NativePointer; /* unsafe native pointers */
}; };