void opinc(Node *n, Node *res) { Value *v; chklval(n->left); v = n->left->sym->v; res->op = OCONST; res->type = v->type; res->nstore = v->vstore; switch(v->type) { case TINT: if(n->op == OPDEC) v->vstore.u0.sival -= fmtsize(v); else v->vstore.u0.sival += fmtsize(v); break; case TFLOAT: if(n->op == OPDEC) v->vstore.u0.sfval--; else v->vstore.u0.sfval++; break; default: error("bad type for post --/++"); } }
void oeinc(Node *n, Node *res) { Value *v; chklval(n->left); v = n->left->sym->v; res->op = OCONST; res->type = v->type; switch(v->type) { case TINT: if(n->op == OEDEC) v->ival -= fmtsize(v); else v->ival += fmtsize(v); break; case TFLOAT: if(n->op == OEDEC) v->fval--; else v->fval++; break; default: error("bad type for pre --/++"); } res->Store = v->Store; }