void VSEncodingNaive::encodeArray(uint32_t *in, uint32_t len, uint32_t *out, uint32_t &nvalue) { uint32_t i; uint32_t j; uint32_t maxB; uint32_t numBlocks; uint32_t *logs; uint32_t *part; BitsWriter *wt; logs = new uint32_t[len]; if (logs == NULL) eoutput("Can't allocate memory"); /* Compute logs of all numbers */ for (i = 0; i < len; i++) logs[i] = __vsenaive_remapLogs[1 + int_utils::get_msb(in[i])]; /* Compute optimal partition */ part = __vsenaive->compute_OptPartition(logs, len, VSENAIVE_LOGLEN + VSENAIVE_LOGLOG, numBlocks); /* Ready to write */ wt = new BitsWriter(out); if (wt == NULL) eoutput("Can't initialize a class"); for (i = 0; i < numBlocks; i++) { /* Compute max B in the block */ for (j = part[i], maxB = 0; j < part[i + 1]; j++) { if (maxB < logs[j]) maxB = logs[j]; } /* Writes the value of B and K */ wt->bit_writer(__vsenaive_codeLogs[maxB], VSENAIVE_LOGLOG); wt->bit_writer(__vsenaive_codeLens[part[i + 1] - part[i]], VSENAIVE_LOGLEN); for (j = part[i]; j < part[i + 1]; j++) wt->bit_writer(in[j], maxB); } /* Align to 32-bit */ wt->bit_flush(); /* Finalization */ delete[] part; delete[] logs; nvalue = wt->written; delete wt; }
void VSEncodingNaive::decodeArray(uint32_t *in, uint32_t len, uint32_t *out, uint32_t nvalue) { uint32_t i; uint32_t B; uint32_t K; uint32_t *end; BitsReader *rd; rd = new BitsReader(in); if (rd == NULL) eoutput("Can't initialize a class"); end = out + nvalue; do { B = __vsenaive_possLogs[rd->bit_reader(VSENAIVE_LOGLOG)]; K = __vsenaive_possLens[rd->bit_reader(VSENAIVE_LOGLEN)]; for (i = 0; i < K; i++) out[i] = (B != 0)? rd->bit_reader(B) : 0; out += K; } while (end > out); }
uint32_t *int_utils::open_and_mmap_file(char *filen, bool write, uint64_t &len) { int file; int ret; uint32_t *addr; struct stat sb; if (write) file = open(filen, O_RDWR); else file = open(filen, O_RDONLY); if (file == -1) eoutput("oepn(): Can't open the file"); /* Do mmap() for file */ ret = fstat(file, &sb); if (ret == -1 || sb.st_size == 0) eoutput("fstat(): Unknown the file size"); len = sb.st_size; __fadvise_sequential(file, len); if (write) addr = (uint32_t *)mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_PRIVATE, file, 0); else addr = (uint32_t *)mmap(NULL, len, PROT_READ, MAP_PRIVATE, file, 0); if (addr == MAP_FAILED) eoutput("mmap(): Can't map the file to memory"); close(file); return addr; }
static int tulosta() { int i,k,imin,h; int j,jj; int gr; int n_used; double min; char rivi[LLENGTH]; char x[LLENGTH]; hav=muste_fopen(tempfile,"r+b"); output_open(eout); sprintf(rivi,"Stepwise cluster analysis by Wilks' Lambda criterion"); eoutput(rivi); sprintf(rivi,"Data %s N=%d",aineisto,n); eoutput(rivi); k=sprintf(rivi,"Variables: "); for (i=0; i<m; ++i) { strcpy(x,d.varname[d.v[i]]); h=strlen(x); while (h && x[h-1]==' ') x[--h]=EOS; k+=sprintf(rivi+k,"%s",x); if (i<m-1) k+=sprintf(rivi+k,", "); if (k>c3-10) { eoutput(rivi); k=0; } } if (k) eoutput(rivi); n_used=0; for (i=0; i<n_saved; ++i) { if (freq[i]==0) break; ++n_used; } if (it==1) { sprintf(rivi," Lambda=%g Clustering saved in %s",f2,d.varname[gvar]); eoutput(rivi); } if (it>1) { sprintf(rivi,"Best clusterings found in %d trials are saved as follows:",it); eoutput(rivi); eoutput(" Lambda freq Grouping var"); imin=0; for (i=0; i<n_used; ++i) { min=1e100; for (k=0; k<n_used; ++k) { if (lambda2[k]<min) { imin=k; min=lambda2[k]; } } lambda2[imin]+=1000.0; ii[i]=imin; /* ennen 7.11.89 =1e100 */ sprintf(rivi,"%10.10f %6d %s",min,freq[imin],d.varname[gvar2[i]]); eoutput(rivi); } } sur_print("\nSaving clusterings..."); for (jj=0L; jj<n; ++jj) { if (sur_kbhit()) { i=sur_getch(); prind=1-prind; } if (prind) { sprintf(sbuf," %d",jj+1); sur_print(sbuf); } hav_read2(jj,&j); if (it==1) { hav_read1(jj,&gr); data_save(&d,j,gvar,(double)gr); } else { for (i=0; i<n_used; ++i) { hav_read4(jj,ii[i],&gr); data_save(&d,j,gvar2[i],(double)gr); } } } if (it==1) { sprintf(x,"clustering in %d groups: Lambda=%g",ng,f2); kirjoita_lauseke(gvar,x); } else { for (i=0; i<n_used; ++i) { sprintf(x,"clustering %d in %d groups: Lambda=%g",i+1,ng,lambda2[ii[i]]-1000.0); kirjoita_lauseke(gvar2[i],x); } } /* 7.11.89 */ output_close(eout); muste_fclose(hav); return(1); }
void VSEncodingBlocksHybrid::decodeArray(uint32_t *in, uint32_t len, uint32_t *out, uint32_t nvalue) { eoutput("Not implemented yet"); }
int main(int argc, char **argv) { int32_t i; int32_t res; int32_t err; uint64_t real_cnt; uint32_t scnt; uint32_t cnt; uint32_t r1; uint32_t r2; int *d; int *d_aligned; int *buf; int *buf_aligned; double srat; double t; int bsr; fprintf(stdout, "Usage: %s [the count of 32-bit ints (2^x)] [shuffling ratio]\n", argv[0]); real_cnt = TEST_DATA_SIZE; srat = SHUFFLE_RATE; while ((res = getopt(argc, argv, "fb")) != -1) { switch (res) { case 'f': _enable_fast_memcpy = 1; printf("enable fast memcpy.\n"); break; case 'b': _enable_bitonic_sort = 1; printf("enable bitonic sort.\n"); break; default: break; } } if (argc - optind >= 1) real_cnt = atoi(argv[optind]); if (argc - optind >= 2) srat = atof(argv[optind + 1]); if (srat < 0.1 || srat > 1.0) { fprintf(stdout, "Error: out of required range for these parameters (16<=x<=30 / 0.1<=ratio<=1.0)"); return EXIT_FAILURE; } bsr = __bsr(real_cnt); cnt = 1 << (bsr + 1); scnt = cnt * srat; fprintf(stdout, "Count:%u Shuffle:%u\n", cnt, scnt); /* Generate test data */ d = malloc(sizeof(int) * cnt + 127); buf = malloc(sizeof(int) * cnt + 127); if (d == NULL || buf == NULL) eoutput("Can't allocate memories"); d_aligned = (int *)_simd_align(d); buf_aligned = (int *)_simd_align(buf); printf("%d\n", RAND_MAX); for (i = 0, d[0] = 0.0; i < cnt - 1; i++) d[i] = rand(); /* Shuffling */ for (i = 0; i < scnt; i++) { r1 = rand() % cnt; r2 = rand() % cnt; _replace_uint32(&d[r1], &d[r2]); } memset(d_aligned + real_cnt, LONG_MAX, cnt - real_cnt); /* Execute bitonic sort */ t = _gettimeofday_sec(); bitonic_sort(d_aligned, cnt, buf_aligned, DEFAULT_CHUNK_NUM); t = _gettimeofday_sec() - t; /* Error chcking */ err = err_check(d_aligned, real_cnt); if (err < 0) eoutput("The returned keys are not completely sorted"); else fprintf(stdout, "Sorting Speed: %.10lfmis\n", (double)(real_cnt / 1000000) / t); free(d); free(buf); return EXIT_SUCCESS; }
void muste_t2test(char *argv) { int i,k; int l,l2; // if (argc==1) return(1); s_init(argv); if (g<3) { sur_print("\nUsage: T2TEST <data1>,<data2>,<output_line>"); WAIT; return; } tulosrivi=0; if (g>3) { tulosrivi=edline2(word[3],1,1); if (tulosrivi==0) return; } simumax=10000; i=spec_init(r1+r-1); if (i<0) return; if ((i=spfind("RESULTS"))>=0) results=atoi(spb[i]); x=NULL; v=NULL; xx=NULL; ind=NULL; s=NULL; s2=NULL; ss[0]=NULL; ss2[0]=NULL; ss[1]=NULL; ss2[1]=NULL; ss_inv=NULL; ss_apu=NULL; ss_apu2=NULL; ero=NULL; i=hae_apu("prind",sbuf); if (i) prind=atoi(sbuf); if ((i=spfind("PRIND"))>=0) prind=atoi(spb[i]); if ((i=spfind("SIMUMAX"))>=0) simumax=atol(spb[i]); method=1; if ((i=spfind("METHOD"))>=0) method=atoi(spb[i]); fixed=0; if ((i=spfind("FIXED"))>=0) fixed=atoi(spb[i]); orig_samples=1; spec_rnd(); strcpy(tempname,etmpd); strcat(tempname,"SURVOHOT.TMP"); tempfile=muste_fopen(tempname,"wb"); if (tempfile==NULL) { sprintf(sbuf,"\nCannot open temporary file %s!",tempname); sur_print(sbuf); WAIT; return; } strcpy(aineisto[0],word[1]); i=data_read_open(aineisto[0],&d); if (i<0) return; i=mask(&d); if (i<0) return; m=d.m_act; if (m==0) { sur_print("\nNo active variables!"); WAIT; return; } x=(double *)muste_malloc(m*sizeof(double)); if (x==NULL) { not_enough_memory(); return; } v=(int *)muste_malloc(m*sizeof(int)); if (v==NULL) { not_enough_memory(); return; } for (i=0; i<m; ++i) v[i]=d.v[i]; sur_print("\n"); talleta(1); /* data 1 */ data_close(&d); strcpy(aineisto[1],word[2]); i=data_read_open(aineisto[1],&d); if (i<0) return; i=mask(&d); if (i<0) return; if (d.m_act!=m) { data_error(); return; } for (i=0; i<m; ++i) { if (v[i]!=d.v[i]) {data_error(); return; } } talleta(2); /* data 2 */ data_close(&d); muste_fclose(tempfile); n[0]=n[1]+n[2]; tempfile=muste_fopen(tempname,"rb"); xx=(double *)muste_malloc(n[0]*m*sizeof(double)); if (xx==NULL) { not_enough_memory(); return; } fread(xx,sizeof(double),n[0]*(int)m,tempfile); muste_fclose(tempfile); ind=muste_malloc(n[0]); if (ind==NULL) { not_enough_memory(); return; } s=muste_malloc(m*sizeof(double)); if (s==NULL) { not_enough_memory(); return; } s2=muste_malloc(m*m*sizeof(double)); if (s2==NULL) { not_enough_memory(); return; } for (l=0; l<n[0]; ++l) ind[l]='1'; laske_summat(s,s2); // Rprintf("s: %g %g\n",s[0],s[1]); getch(); ss[0]=muste_malloc(m*sizeof(double)); if (ss[0]==NULL) { not_enough_memory(); return; } ss2[0]=muste_malloc(m*m*sizeof(double)); if (ss2[0]==NULL) { not_enough_memory(); return; } ss[1]=muste_malloc(m*sizeof(double)); if (ss[1]==NULL) { not_enough_memory(); return; } ss2[1]=muste_malloc(m*m*sizeof(double)); if (ss2[1]==NULL) { not_enough_memory(); return; } ss_inv=muste_malloc(m*m*sizeof(double)); if (ss_inv==NULL) { not_enough_memory(); return; } ss_apu=muste_malloc(m*m*sizeof(double)); if (ss_apu==NULL) { not_enough_memory(); return; } ss_apu2=muste_malloc(m*m*sizeof(double)); if (ss_apu2==NULL) { not_enough_memory(); return; } ero=muste_malloc(m*sizeof(double)); if (ero==NULL) { not_enough_memory(); return; } // Todelliset otokset for (l=0; l<n[0]; ++l) ind[l]='0'; for (l=0; l<n[1]; ++l) ind[l]='1'; t2_0=T2(); p_hot=1.0-muste_cdf_f((double)(n[0]-m-1)/(n[0]-2)/(double)m*t2_0, (double)m,(double)(n[1]+n[2]-m-1),1e-15); if (method==2) { t2_BF0=T2_BF(); yao_test(); print_t2_yao(); } // Rprintf("\nt2: %g %g",t2_0,t2_BF0); getch(); else print_t2_hot(); if (fixed) orig_samples=0; ++scroll_line; nn1=0L; k=0; if (simumax) sur_print("\nInterrupt by '.'"); for (nn=1; nn<=simumax; ++nn) { // Rprintf("\nnn=%d",nn); for (l=0; l<n[0]; ++l) ind[l]='0'; for (l=0; l<n[1]; ++l) { while (1) { l2=n[0]*uniform_dev(); if (ind[l2]=='1') continue; ind[l2]='1'; break; } } if (method==1) { t2_1=T2(); // Rprintf("t2: %g %g\n",t2_1,t2_0); getch(); if (t2_1>t2_0) ++nn1; } else { t2_1=T2_BF(); // Rprintf("t2: %g %g\n",t2_1,t2_BF0); getch(); if (t2_1>t2_BF0) ++nn1; } ++k; // Rprintf("t2=%g\n",t2_1); i=getch(); if (i=='.') break; /********************************** if (sur_kbhit()) { i=sur_getch(); if (i=='.') break; prind=1-prind; } ***********************************/ if (k>=1000 && prind) { sprintf(sbuf,"\n%d %g ",nn,(double)nn1/(double)nn); sur_print(sbuf); k=0; } } // Rprintf("4"); sur_getch(); output_open(eout); --nn; if (method==1) { eoutput("Hotelling's two-sample test for equality of mean vectors:"); sprintf(sbuf,"T2=%g p=%d n1=%d n2=%d P1=%g", t2_0,m,n[1],n[2],p_hot); } else { eoutput("Yao's two-sample test for equality of mean vectors:"); sprintf(sbuf,"T2=%g P1=%g (assuming nonequal cov.matrices)", t2_BF0,p_yao); } eoutput(sbuf); if (simumax>0L) { eoutput("Randomization test:"); p_sim=(double)nn1/(double)nn; sprintf(sbuf,"N=%d P=%g (s.e. %g) %s", nn,p_sim,sqrt(p_sim*(1-p_sim)/nn),method_text[method-1]); eoutput(sbuf); } output_close(eout); s_end(argv); return; }
void muste_covtest(char *argv) { int i,k,h,kk; int l,l2,li; // if (argc==1) return(1); s_init(argv[1]); if (g<2) { sur_print("\nUsage: COVTEST <output_line>"); sur_print("\n SAMPLES=<data(1),...,<data(m)>"); WAIT; return; } tulosrivi=0; if (g>1) { tulosrivi=edline2(word[1],1,1); if (tulosrivi==0) return; } i=spec_init(r1+r-1); if (i<0) return; if ((i=spfind("RESULTS"))>=0) results=atoi(spb[i]); i=hae_apu("prind",sbuf); if (i) prind=atoi(sbuf); if ((i=spfind("PRIND"))>=0) prind=atoi(spb[i]); simumax=10000; if ((i=spfind("SIMUMAX"))>=0) simumax=atol(spb[i]); spec_rnd(); strcpy(tempname,etmpd); strcat(tempname,"SURVOCOV.TMP"); tempfile=fopen(tempname,"wb"); if (tempfile==NULL) { sprintf(sbuf,"\nCannot open temporary file %s!",tempname); sur_print(sbuf); WAIT; return; } i=spfind("SAMPLES"); if (i<0) { sur_print("SAMPLES=<data(1),...,<data(m)> missing!"); WAIT; return; } strcpy(y,spb[i]); ns=split(y,otos,S_MAX); if (ns<2) { sur_print("At least 2 samples must be given by SAMPLES!"); WAIT; return; } x=NULL; v=NULL; xx=NULL; ind=NULL; nt=0L; for (k=0; k<ns; ++k) { strcpy(aineisto,otos[k]); i=data_read_open(aineisto,&d); if (i<0) return; i=mask(&d); if (i<0) return; if (d.m_act==0) { sur_print("\nNo active variables!"); WAIT; return; } if (k==0) { m=d.m_act; x=(double *)muste_malloc(m*sizeof(double)); if (x==NULL) { not_enough_memory(); return; } v=(int *)muste_malloc(m*sizeof(int)); if (v==NULL) { not_enough_memory(); return; } for (i=0; i<m; ++i) v[i]=d.v[i]; } if (k!=0) { if (d.m_act!=m) { data_error(k); return; } for (i=0; i<m; ++i) { if (v[i]!=d.v[i]) { data_error(k); return; } } } sur_print("\n"); talleta(k); /* data k */ data_close(&d); } muste_fclose(tempfile); tempfile=fopen(tempname,"rb"); xx=(double *)muste_malloc(nt*m*sizeof(double)); if (xx==NULL) { not_enough_memory(); return; } fread(xx,sizeof(double),nt*(int)m,tempfile); muste_fclose(tempfile); ind=muste_malloc(sizeof(short)*nt); if (ind==NULL) { not_enough_memory(); return; } for (k=0; k<ns+1; ++k) { s[k]=NULL; s[k]=muste_malloc(m*sizeof(double)); if (s[k]==NULL) { not_enough_memory(); return; } s2[k]=NULL; s2[k]=muste_malloc(m*m*sizeof(double)); if (s2[k]==NULL) { not_enough_memory(); return; } } l=0; for (k=0; k<ns; ++k) for (li=0L; li<n[k]; ++li) ind[l++]=k; laske_summat(); l=0; for (k=0; k<ns; ++k) for (li=0; li<n[k]; ++li) { for (h=0; h<m; ++h) xx[l+h]-=s[k][h]/n[k]; l+=m; } t0=testi(); os1=(double)(nt-ns)*m/2*log((double)(nt-ns)); nim2=0.0; a=0.0; for (k=0; k<ns; ++k) { nim2+=(n[k]-1)*muste_log((double)(n[k]-1)); a+=1.0/(n[k]-1); } x2=t0/2+os1-(double)m/2*nim2; a=1-(a-1.0/(nt-ns))*(2*m*m+3*m-1)/6.0/(m+1)/(k-1); x2*=-2*a; // Rprintf("x2=%g\n",x2); getch(); df=(double)m/2*(m+1)*(ns-1); pr_x2=1.0-muste_cdf_chi2(x2,df,1e-7); /***************************************************** os1=n*p/2*log(n) os1=10326.054776478 os2=0.5*(n1*log(det1)+n2*log(det2)+n3*log(det3)) os2=8299.3933358899 nim1=n/2*log(det) nim1=9932.2525957076 nim2=p/2*(n1*log(n1)+n2*log(n2)+n3*log(n3)) nim2=8697.69129334 logL=os1+os2-nim1-nim2 logL=-4.4957766798343 a=1-(1/n1+1/n2+1/n3-1/n)*(2*p*p+3*p-1)/6/(p+1)/(k-1) X2=-2*a*logL X2=8.9516537694752 df=p/2*(p+1)*(k-1) ********************************************************/ print_t0(x2,df,pr_x2); ++scroll_line; nn1=0L; kk=0; for (nn=1; nn<=simumax; ++nn) { for (l=0; l<nt; ++l) ind[l]=0; for (k=1; k<ns; ++k) { for (l=0L; l<n[k]; ++l) { while (1) { l2=nt*uniform_dev(); if (ind[l2]!=(short)0) continue; ind[l2]=k; break; } } } t1=testi(); if (t1<t0) ++nn1; ++kk; /************************* if (kbhit()) { i=getch(); if (i=='.') break; prind=1-prind; } ******************************/ if (kk==1000) { if (prind) { sprintf(sbuf,"\n%d %g ",nn,(double)nn1/(double)nn); sur_print(sbuf); } kk=0; } } output_open(eout); --nn; eoutput("Comparing covariance matrices:"); sprintf(sbuf,"Asymptotic X^2 test: X2=%g df=%g P=%g",x2,df,pr_x2); eoutput(sbuf); p_sim=(double)nn1/(double)nn; sprintf(sbuf,"Randomization test: N=%d P=%g (s.e. %g)", nn,p_sim,sqrt(p_sim*(1-p_sim)/nn)); eoutput(sbuf); output_close(eout); s_end(argv); return; }
uint32_t * VSEncoding::compute_OptPartition(uint32_t *seq, uint32_t len, uint32_t fixCost, uint32_t &pSize) { int *SSSP; uint32_t i; uint32_t maxB; uint32_t *part; uint64_t curCost; uint64_t *cost; /* It will store the shortest path */ SSSP = new int[len + 1]; /* cost[i] will contain the cost of encoding up to i-th position */ cost = new uint64_t[len + 1]; if (SSSP == NULL || cost == NULL) eoutput("Can't allocate memory"); for (i = 0; i <= len; i++) { SSSP[i] = -1; cost[i] = 0; } /* * This loop computes the cost of the optimal partition. * The computation of the max log in each block is done * by scanning. Probably we could obtain a faster solution * by using RMQ data structures. We use this trivial * solution since construction time is not our main concern. */ { int mleft; int j; int g; int l; for (i = 1; i <= len; i++) { mleft = ((int)(i - maxBlk) > 0)? i - maxBlk : 0; for (maxB = 0, l = 0, g = 0, j = i - 1; j >= mleft; j--) { if (maxB < seq[j]) maxB = seq[j]; if (posszLens == NULL) { /* * FIXME: If the gaps of elements in possLens[] are * sparse, a process below is more efficient to hop * these gaps using the elements rather than * decrementing j. */ if (i - j != possLens[l]) continue; else l++; } else { /* * Treat runs of 0 in a different way. * They could form larger blocks! */ if (maxB != 0) { mleft = ((int)(i - maxBlk) > 0)? i - possLens[poss_sz - 1] : 0; if (i - j != possLens[l]) continue; if (i - j == possLens[l]) l++; } else { if (i - j == possLens[l]) l++; if (i - j != posszLens[g]) continue; if (i - j == posszLens[g]) g++; } } /* Caluculate costs */ if (aligned) curCost = cost[j] + int_utils::div_roundup((i - j) * maxB, 32) + fixCost; else curCost = cost[j] + (i - j) * maxB + fixCost; if (SSSP[i] == -1) cost[i] = curCost + 1; if (curCost <= cost[i]) { cost[i] = curCost; SSSP[i] = j; } } } } /* Compute number of nodes in the path */ { int next; pSize = 0; next = len; while (next != 0) { next = SSSP[next]; pSize++; } /* * Obtain the optimal partition starting * from the last block. */ part = new uint32_t[pSize + 1]; if (part == NULL) eoutput("Can't allocate memory"); i = pSize; next = len; while (next != 0) { part[i--] = next; next = SSSP[next]; } part[0] = 0; } /* Finalization */ delete[] SSSP; delete[] cost; return part; }
int main(int argc, char **argv) { int i; int j; int size; int bcnt[2]; int nwrite; char ans; char *str; char *end; double r; if(argc < 2) size = NSTRING; else size = strtol(argv[1], &end, 10); if(size < 10 || size > MAX_NSTRING || errno == ERANGE) _usage("Range Exception (10 <= x <= %d)\n", MAX_NSTRING); /* Initialization */ srand(time(NULL)); ans = 0; str = malloc(sizeof(char) * size); if(str == NULL) eoutput("Can't allocate memories"); memset(str, ANSWER_CHAR, sizeof(char) * size); nwrite = size / 2 - rand() % (size / 2); doutput(CONSOLE_OUTPUT, "nwrite: %d\n", nwrite); for (i = 0; i < size && nwrite > 0; i++) { r = (double)rand() / UINT_MAX; doutput(CONSOLE_OUTPUT, "r: %lf\n", r); if(r < 0.20) { str[i] = 'b' + rand() % 25; nwrite--; } } #ifdef DEBUG for (i = 0; i < size; i++) fprintf(stdout, "%c ", str[i]); fprintf(stdout, "\n"); #endif /* DEBUG */ /* Start solving ... */ for(i = 0; i < sizeof(char) * 8; i++) { memset(&bcnt[0], 0x00, sizeof(int) * 2); for(j = 0; j < size; j++) { bcnt[BITCOUNT(str[j], i)]++; if(j > size / 2 && (bcnt[0] > size / 2 || bcnt[1] > size / 2)) break; } ans |= ((bcnt[0] > bcnt[1])? 0 : 1) << i; } doutput(CONSOLE_OUTPUT, "answer: %c\n", ans); if(ans == ANSWER_CHAR) fprintf(stdout, "Done correctly\n"); else fprintf(stdout, "Done wrongly\n"); return EXIT_SUCCESS; }
void VSEncodingRest::encodeArray(uint32_t *in, uint32_t len, uint32_t *out, uint32_t &nvalue) { eoutput("Not implemented yet"); }