static void nocmov(int x, int y) { if (cury > y) { if(UP) { while (cury > y) { /* Go up. */ xputs(UP); cury--; } } else if(CM) { cmov(x, y); } else if(HO) { home(); curs(x, y); } /* else impossible("..."); */ } else if (cury < y) { if(XD) { while(cury < y) { xputs(XD); cury++; } } else if(CM) { cmov(x, y); } else { while(cury < y) { xputc('\n'); curx = 1; cury++; } } } if (curx < x) { /* Go to the right. */ if(!ND) cmov(x, y); else /* bah */ /* should instead print what is there already */ while (curx < x) { xputs(ND); curx++; } } else if (curx > x) { while (curx > x) { /* Go to the left. */ xputs(BC); curx--; } } }
/* int x, y; not xchar: perhaps xchar is unsigned and * curx-x would be unsigned as well */ void curs(int x, int y) { if (y == cury && x == curx) return; if(!ND && (curx != x || x <= 3)) { /* Extremely primitive */ cmov(x, y); /* bunker!wtm */ return; } if(abs(cury-y) <= 3 && abs(curx-x) <= 3) nocmov(x, y); else if((x <= 3 && abs(cury-y)<= 3) || (!CM && x<abs(curx-x))) { (void) putchar('\r'); curx = 1; nocmov(x, y); } else if(!CM) { nocmov(x, y); } else cmov(x, y); }
int ChebyshevFilter::zplna() { cmplx r, cnum, cden, cwc, ca, cb, b4ac; double C; if( kind == 3 ) C = c; else C = wc; for( i=0; i<ARRSIZ; i++ ) { z[i].r = 0.0; z[i].i = 0.0; } nc = np; jt = -1; ii = -1; for( icnt=0; icnt<2; icnt++ ) { /* The maps from s plane to z plane */ do { ir = ii + 1; ii = ir + 1; r.r = zs[ir]; r.i = zs[ii]; switch( type ) { case 1: case 3: /* Substitute s - r = s/wc - r = (1/wc)(z-1)/(z+1) - r * * 1 1 - r wc ( 1 + r wc ) * = --- -------- ( z - -------- ) * z+1 wc ( 1 - r wc ) * * giving the root in the z plane. */ cnum.r = 1 + C * r.r; cnum.i = C * r.i; cden.r = 1 - C * r.r; cden.i = -C * r.i; jt += 1; cdiv( &cden, &cnum, &z[jt] ); if( r.i != 0.0 ) { /* fill in complex conjugate root */ jt += 1; z[jt].r = z[jt-1 ].r; z[jt].i = -z[jt-1 ].i; } break; case 2: case 4: /* Substitute s - r => s/wc - r * * z^2 - 2 z cgam + 1 * => ------------------ - r * (z^2 + 1) wc * * 1 * = ------------ [ (1 - r wc) z^2 - 2 cgam z + 1 + r wc ] * (z^2 + 1) wc * * and solve for the roots in the z plane. */ if( kind == 2 ) cwc.r = cbp; else cwc.r = c; cwc.i = 0.0; cmul( &r, &cwc, &cnum ); /* r wc */ csub( &cnum, &cone, &ca ); /* a = 1 - r wc */ cmul( &cnum, &cnum, &b4ac ); /* 1 - (r wc)^2 */ csub( &b4ac, &cone, &b4ac ); b4ac.r *= 4.0; /* 4ac */ b4ac.i *= 4.0; cb.r = -2.0 * cgam; /* b */ cb.i = 0.0; cmul( &cb, &cb, &cnum ); /* b^2 */ csub( &b4ac, &cnum, &b4ac ); /* b^2 - 4 ac */ csqrt( &b4ac, &b4ac ); cb.r = -cb.r; /* -b */ cb.i = -cb.i; ca.r *= 2.0; /* 2a */ ca.i *= 2.0; cadd( &b4ac, &cb, &cnum ); /* -b + sqrt( b^2 - 4ac) */ cdiv( &ca, &cnum, &cnum ); /* ... /2a */ jt += 1; cmov( &cnum, &z[jt] ); if( cnum.i != 0.0 ) { jt += 1; z[jt].r = cnum.r; z[jt].i = -cnum.i; } if( (r.i != 0.0) || (cnum.i == 0) ) { csub( &b4ac, &cb, &cnum ); /* -b - sqrt( b^2 - 4ac) */ cdiv( &ca, &cnum, &cnum ); /* ... /2a */ jt += 1; cmov( &cnum, &z[jt] ); if( cnum.i != 0.0 ) { jt += 1; z[jt].r = cnum.r; z[jt].i = -cnum.i; } } } /* end switch */ } while( --nc > 0 ); if( icnt == 0 ) { zord = jt+1; if( nz <= 0 ) { if( kind != 3 ) return(0); else break; } } nc = nz; } /* end for() loop */ return 0; }
void InterpreterRuntime::SignatureHandlerGenerator::pass_object() { const Address src(from(), Interpreter::local_offset_in_bytes(offset())); #ifdef _WIN64 switch (_num_args) { case 0: assert(offset() == 0, "argument register 1 can only be (non-null) receiver"); __ lea(c_rarg1, src); _num_args++; break; case 1: __ lea(rax, src); __ xorl(c_rarg2, c_rarg2); __ cmpptr(src, 0); __ cmov(Assembler::notEqual, c_rarg2, rax); _num_args++; break; case 2: __ lea(rax, src); __ xorl(c_rarg3, c_rarg3); __ cmpptr(src, 0); __ cmov(Assembler::notEqual, c_rarg3, rax); _num_args++; break; default: __ lea(rax, src); __ xorl(temp(), temp()); __ cmpptr(src, 0); __ cmov(Assembler::notEqual, temp(), rax); __ movptr(Address(to(), _stack_offset), temp()); _stack_offset += wordSize; break; } #else switch (_num_int_args) { case 0: assert(offset() == 0, "argument register 1 can only be (non-null) receiver"); __ lea(c_rarg1, src); _num_int_args++; break; case 1: __ lea(rax, src); __ xorl(c_rarg2, c_rarg2); __ cmpptr(src, 0); __ cmov(Assembler::notEqual, c_rarg2, rax); _num_int_args++; break; case 2: __ lea(rax, src); __ xorl(c_rarg3, c_rarg3); __ cmpptr(src, 0); __ cmov(Assembler::notEqual, c_rarg3, rax); _num_int_args++; break; case 3: __ lea(rax, src); __ xorl(c_rarg4, c_rarg4); __ cmpptr(src, 0); __ cmov(Assembler::notEqual, c_rarg4, rax); _num_int_args++; break; case 4: __ lea(rax, src); __ xorl(c_rarg5, c_rarg5); __ cmpptr(src, 0); __ cmov(Assembler::notEqual, c_rarg5, rax); _num_int_args++; break; default: __ lea(rax, src); __ xorl(temp(), temp()); __ cmpptr(src, 0); __ cmov(Assembler::notEqual, temp(), rax); __ movptr(Address(to(), _stack_offset), temp()); _stack_offset += wordSize; break; } #endif }