From aa90c02dff7e30a6d4129c212bd9455a663246df Mon Sep 17 00:00:00 2001 From: programagor Date: Fri, 1 Jun 2018 17:43:42 +0200 Subject: [PATCH] Tried to address #4, but the bug is still in place --- bin/rainbrot-gen | Bin 24552 -> 24552 bytes src/main.c | 15 +++++++++------ src/worker.c | 31 +++++++++++++++++++++++++------ 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/bin/rainbrot-gen b/bin/rainbrot-gen index ef9f4be92117ed5f99f934b23202978d4b4b27a6..46dd23ea445d3ff0917e3e0d7303fb7bb8631665 100755 GIT binary patch delta 5755 zcmZu#3sh5Qwmv631Z#5w;tLgmHz)!M=@m2;#zcZWfe2h*rIk)mE2AxKGa8g>b%G61 z&m7a@{o7g0toB~pTRXj7?Hy-Ww3anMP(-maYhgR>fQqF)>dByjj9NOKHuu{n2}9{* zt&{(;zkk2?K7XRL^GZA4FjK=N9Zr0I@|*`b^)u(e!{^)LhjW6f;T*F%8O~wv@aGe@ z?u&{4`LjQ}d*ylUyYauUT{#k+x~{2FlP#ngQaJ9kr}5iBfbb)NE+D{_!ndTiDEzjk$Q#)lPjmOcu(+@j%e&Kq$Oa%ciP9_E z=tPjJeDMwD9-kM;24fSr(Rg$VhTgS78$ z)&~NCcDRXCj>3Q4M|aEv)88?T#EsP zd_&uRtA;9Hj>5a1dyhUM)Vsk82EM#l&sn^718?_wRKF}4XY3>>>3xuycE6p3 zhpeFD0eSz|*piz`dnpq74*SoNcsV~GjM9wvlnoH&pG(Ou=ci*2`Bw*LwA32^nN)AE zYcq`ZH2~@M@j`uU6ibZPD~?-+4Y_42VC?)F60}W zyPSb@BJ6;lLWQUNSVgGSBJI`cKECFS;Al*UtCX^22JwvG2h zw{Lp5oft-^(3V{a*raR943;n}Rdf3*wtQAceG9Be|+M@?|j`?RjsjWd#j%CPEwkdJ;L+GOOlU-^>!f|7s15; zv08ZfW};SxLk40y5&wd$9t+Hmf~A`aWVpLK!t8M1MLJLqZta0AxV98(R+iqe@Sq-(J==%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ze=g9L4-N832c;HykU9nZO<(U8}RkM|=Sox-~hIBQCI+)mz=sB!5lj c_y_*eyJJmGT%Goh-?|)?E2E)nO``t)02q6_3IG5A diff --git a/src/main.c b/src/main.c index a301f97..c2016b5 100644 --- a/src/main.c +++ b/src/main.c @@ -105,7 +105,12 @@ int main (int argc,char** argv) off_t fsize = (off_t)(sizeof(uint64_t))*args.re_size*args.im_size; int files[l]; uint64_t *maps[l]; - + uint64_t *zeros=calloc(args.re_size,sizeof(uint64_t)); /* String full of zeros, to write into new files in batches */ + if(!zeros) + { + fprintf(stderr,"Can't create a string full of zeros, quitting\n"); + return(1); + } for(int i=0; ire_size*sizeof(uint64_t*)); + if(!buff) + { + fprintf(stderr,"Can't allocate space for buffer array\n"); + exit(1); + } for(uint32_t x=0;xre_size;x++) { buff[x]=calloc(arg->im_size,sizeof(uint64_t)); @@ -29,6 +34,14 @@ void* worker(void *arg_v) exit(1); } } + + /* Keep track of which rows were written to */ + uint8_t *dirty_rows=calloc(arg->re_size,sizeof(uint8_t)); + if(!dirty_rows) + { + fprintf(stderr,"Can't allocate space for dirty rows marker, quitting\n"); + exit(1); + } /* Run until number of runs is reached */ while(1) @@ -90,8 +103,7 @@ void* worker(void *arg_v) while(inside==1); int64_t idx_x,idx_y; /* buff (2D array) coords */ - uint8_t dirty_rows[arg->re_size]; - for(uint32_t i=0;i< arg->re_size ;dirty_rows[i++]=0); /*zero dirty rows */ + /* Now we have a point which is outside, can iterate and draw */ Z=c; uint64_t i; @@ -132,10 +144,17 @@ void* worker(void *arg_v) } pthread_mutex_unlock(&arg->locks[k]); - for(uint32_t x=0;xre_size;x++)for(uint32_t y=0;yim_size;y++) - { - buff[x][y]=0; - } + for(uint32_t x=0;x< arg->re_size;x++) + { + if(dirty_rows[x]) + { + for(uint32_t y=0;y< arg->im_size;y++) + { + buff[x][y]=0; + } + dirty_rows[x]=0; + } + } } }