// Returns (x, y) such that ax + by = gcd(a, b) pll bezout(lint a, lint b) { if (b == 0) return pll(1, 0); pll p = bezout(b, a % b); return pll(p.second, p.first - (a / b) * p.second); }
int main() { while(1) { pll(); } }
void getamp(pll_t *phaselock, float *ambuff, float *sound_samples, int nb) { int n; for (n = 0; n < nb; n++) { ambuff[n] = pll(phaselock, sound_samples[n]); } }
void AMDemod (AMD am) { int i; REAL demout; switch (am->mode) { case SAMdet: for (i = 0; i < am->size; i++) { pll (am, CXBdata (am->ibuf, i)); demout = dem (am); CXBdata (am->obuf, i) = Cmplx (demout, demout); } break; case AMdet: for (i = 0; i < am->size; i++) { am->lock.curr = Cmag (CXBdata (am->ibuf, i)); am->dc = 0.9999f * am->dc + 0.0001f * am->lock.curr; am->smooth = 0.5f * am->smooth + 0.5f * (am->lock.curr /*- am->dc*/); /* demout = am->smooth; */ CXBdata (am->obuf, i) = Cmplx (am->smooth, am->smooth); } break; } }
/* ---------------------------------------------------------------------------- */ void FMDemod(FMD fm) { int i; for (i = 0; i < CXBhave(fm->ibuf); i++) { pll(fm, CXBdata(fm->ibuf, i)); fm->afc = (REAL) (0.9999 * fm->afc + 0.0001 * fm->pll.freq.f); CXBreal(fm->obuf, i) = CXBimag(fm->obuf, i) = (fm->pll.freq.f - fm->afc) * fm->cvt; } }
void CFMDemod::demodulate() { unsigned int n = CXBhave(m_ibuf); for (unsigned int i = 0; i < n; i++) { pll(CXBdata(m_ibuf, i)); m_afc = float(0.9999 * m_afc + 0.0001F * m_pllFreqF); CXBreal(m_obuf, i) = CXBimag(m_obuf, i) = (m_pllFreqF - m_afc) * m_cvt; } CXBhave(m_obuf) = n; }
/* * Dump the contents of a socket structure */ void socket_dump(u_long off) { struct socket so; if (off == 0) return; kread(off, &so, sizeof(so)); #define p(fmt, v, sep) printf(#v " " fmt sep, so.v); #define pll(fmt, v, sep) printf(#v " " fmt sep, (long long) so.v); #define pp(fmt, v, sep) printf(#v " " fmt sep, hideroot ? 0 : so.v); printf("socket %#lx\n ", hideroot ? 0 : off); p("%#.4x", so_type, "\n "); p("%#.4x", so_options, "\n "); p("%d", so_linger, "\n "); p("%#.4x", so_state, "\n "); pp("%p", so_pcb, ", "); pp("%p", so_proto, ", "); pp("%p", so_head, "\n "); p("%d", so_q0len, ", "); p("%d", so_qlen, ", "); p("%d", so_qlimit, "\n "); p("%d", so_timeo, "\n "); p("%u", so_error, "\n "); p("%d", so_pgid, ", "); p("%u", so_siguid, ", "); p("%u", so_sigeuid, "\n "); p("%lu", so_oobmark, "\n "); pp("%p", so_splice, ", "); pp("%p", so_spliceback, "\n "); p("%lld", so_splicelen, ", "); p("%lld", so_splicemax, ", "); pll("%lld", so_idletv.tv_sec, ", "); p("%ld", so_idletv.tv_usec, "\n "); sockbuf_dump(&so.so_rcv, "so_rcv"); sockbuf_dump(&so.so_snd, "so_snd"); p("%u", so_euid, ", "); p("%u", so_ruid, ", "); p("%u", so_egid, ", "); p("%u", so_rgid, "\n "); p("%d", so_cpid, "\n"); #undef p #undef pp if (!vflag) return; protosw_dump((u_long)so.so_proto, (u_long)so.so_pcb); }
int main () { int t; si(t); while(t--) { long long int n,i,k; sll(n); k=log(n)/log(2); i=2*(n-pow(2,k))+1; pll(i); nl; } return 0; }