int gensub(int p1, int p2, int swapped) { int rp = PINT; gentext(); if (cgload2() || !swapped) cgswap(); if (!inttype(p1) && !inttype(p2) && p1 != p2) error("incompatible pointer types in binary '-'", NULL); if (ptr(p1) && !ptr(p2)) { if (needscale(p1)) { if ( (p1 & STCMASK) == STCPTR || (p1 & STCMASK) == UNIPTR ) cgscale2by(objsize(deref(p1), TVARIABLE, 1)); else cgscale2(); } rp = p1; } cgsub(); if (needscale(p1) && needscale(p2)) { if ( (p1 & STCMASK) == STCPTR || (p1 & STCMASK) == UNIPTR ) cgunscaleby(objsize(deref(p1), TVARIABLE, 1)); else cgunscale(); } return rp; }
int genadd(int p1, int p2, int swapped) { int rp = PINT, t; gentext(); if (cgload2() || !swapped) { t = p1; p1 = p2; p2 = t; } if (ptr(p1)) { if (needscale(p1)) { if ( (p1 & STCMASK) == STCPTR || (p1 & STCMASK) == UNIPTR ) cgscale2by(objsize(deref(p1), TVARIABLE, 1)); else cgscale2(); } rp = p1; } else if (ptr(p2)) { if (needscale(p2)) { if ( (p2 & STCMASK) == STCPTR || (p2 & STCMASK) == UNIPTR ) cgscaleby(objsize(deref(p2), TVARIABLE, 1)); else cgscale(); } rp = p2; } cgadd(); return rp; }
void genscale2(void) { gentext(); commit(); cgscale2(); }