/* searchLitOp - search tree (*ops only) for an ast with literal */
/*-----------------------------------------------------------------*/
static ast *
-searchLitOp (ast *tree, ast **parent, const unsigned char *ops)
+searchLitOp (ast *tree, ast **parent, const char *ops)
{
ast *ret;
/* rearrange the tree */
if (IS_LITERAL (RTYPE (tree))
/* avoid infinite loop */
- && (TYPE_UDWORD) floatFromVal (tree->right->opval.val) != 1)
+ && (TYPE_TARGET_ULONG) floatFromVal (tree->right->opval.val) != 1)
{
ast *parent;
ast *litTree = searchLitOp (tree, &parent, "/");
/* rearrange the tree */
if (IS_LITERAL (RTYPE (tree))
/* avoid infinite loop */
- && (TYPE_UDWORD) floatFromVal (tree->right->opval.val) != 0)
+ && (TYPE_TARGET_ULONG) floatFromVal (tree->right->opval.val) != 0)
{
ast *litTree, *litParent;
litTree = searchLitOp (tree, &litParent, "+-");
/* if only the right side is a literal & we are
shifting more than size of the left operand then zero */
if (IS_LITERAL (RTYPE (tree)) &&
- ((TYPE_UDWORD) floatFromVal (valFromType (RETYPE (tree)))) >=
+ ((TYPE_TARGET_ULONG) floatFromVal (valFromType (RETYPE (tree)))) >=
(getSize (TETYPE (tree)) * 8))
{
if (tree->opval.op==LEFT_OP ||
unsigned int gptype = 0;
unsigned int addr = SPEC_ADDR (sym->etype);
- if (IS_GENPTR (LTYPE (tree)) && GPTRSIZE > FPTRSIZE)
+ if (IS_GENPTR (LTYPE (tree)) && ((GPTRSIZE > FPTRSIZE)
+ || TARGET_IS_PIC16) )
{
switch (SPEC_SCLS (sym->etype))
{
break;
default:
gptype = 0;
+
+ if(TARGET_IS_PIC16 && (SPEC_SCLS(sym->etype) == S_FIXED))
+ gptype = GPTYPE_NEAR;
}
addr |= gptype << (8*(GPTRSIZE - 1));
}
/* while-loops insert a label between the IFX and the condition,
therefore look behind the label too */
if (tree->opval.op == LABEL &&
+ tree->right &&
IS_ANDORNOT (tree->right))
{
tree->right = backPatchLabels (tree->right, trueLabel, falseLabel);
if (!IS_AST_LIT_VALUE (tree->right))
return -1;
- return powof2 ((TYPE_UDWORD)AST_LIT_VALUE (tree->right));
+ return powof2 ((TYPE_TARGET_ULONG)AST_LIT_VALUE (tree->right));
}
/*-----------------------------------------------------------------*/
if (IS_LITERAL (tree->opval.val->etype)) {
fprintf(outfile,"CONSTANT (%p) value = ", tree);
if (SPEC_USIGN (tree->opval.val->etype))
- fprintf(outfile,"%u", (TYPE_UDWORD) floatFromVal(tree->opval.val));
+ fprintf(outfile,"%u", (TYPE_TARGET_ULONG) floatFromVal(tree->opval.val));
else
- fprintf(outfile,"%d", (TYPE_DWORD) floatFromVal(tree->opval.val));
- fprintf(outfile,", 0x%x, %f", (TYPE_UDWORD) floatFromVal(tree->opval.val),
+ fprintf(outfile,"%d", (TYPE_TARGET_LONG) floatFromVal(tree->opval.val));
+ fprintf(outfile,", 0x%x, %f", (TYPE_TARGET_ULONG) floatFromVal(tree->opval.val),
floatFromVal(tree->opval.val));
} else if (tree->opval.val->sym) {
/* if the undefined flag is set then give error message */