Skip to content

Commit

Permalink
Some code optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
asimba committed Jun 26, 2023
1 parent 3b014fd commit 4a87b2f
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 21 deletions.
12 changes: 6 additions & 6 deletions axissums
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
5e2a6182f5455d95869a16753c56079eef9775e1 ./LICENSE
09112e52227f0182675725568c005221164cd671 ./README.md
547331b6beccf7bd63231084b8fa85db7202da80 ./makefile
ce03803d6de51f35f512581bd9a2f37fb28b3190 ./bin/axis
1c5511f60d3557a0f54d9051eccf2e9e1b7ccece ./bin/axis.exe
2766af9a695d1cda4f00a3c5245d8e41e8be6a4b ./bin/axis
e3bffc508c9fd151cb04bab780621a5d270e7bfe ./bin/axis.exe
ffd10c35dad3e3cedac3969b7c77153084e12e51 ./bin/axisgui.py
20bbf8559dfdc191399c4b80a07ab28fe85d1d9f ./src/archive.cc
681b5f03eff93283c4a3a2bef493bb61961d3a8e ./src/archive.h
Expand All @@ -16,7 +16,7 @@ c401f18709e9ba1200f7be24e722197147735369 ./src/axislogo.svg
ac28702e2fc0df8d7adee5d33a75d81b32fbfbd4 ./src/axisum.h
99e08b3d63bc04321940cb164ea851530a4dbd03 ./src/bnode.cc
66872236291e1a931acbd9adeeb496d18c61ddcb ./src/bnode.h
7e02245b76a07a881a8fc7e5776176034c85cac7 ./src/build.inc
440e0ad1a3a5761383d98f9e4b0f74800d4b2162 ./src/build.inc
4d94b873542e3d87b318cf24f2c15dd226b2434d ./src/buildinc
9f1cd4c3b54f4c7bfd6c350067a99977a86a7d32 ./src/canonicalize.cc
6d06c63018cf30c1ca1b78d6a33dde98aedfe388 ./src/canonicalize.h
Expand Down Expand Up @@ -51,7 +51,7 @@ e3b60e4feb6a99f12af95e078bbc8b7f603fba36 ./src/langdata.py
c95f3e2a22128e7e83108e5e52f735d9542598c9 ./src/makefile.mk
db1f0474200d1ff94e42a862cb8e9c637b2189dc ./src/mdirs.cc
2abbe0769065cbc81448baca09d6d30960862e06 ./src/mdirs.h
41d84b39cba89b7c883f0ae8e0b8a71000898f01 ./src/packer.cc
d228435091751b36527cf6e74094cb323d4ddc03 ./src/packer.cc
bdaa58caee968f5cf0ceb06624a3e6dcf0e94a66 ./src/packer.h
56a1e17ff2d6fbd94daabf810234c253490d870b ./src/permutation.cc
fae079803baac75cbf6154a3f536628310f7e768 ./src/permutation.h
Expand All @@ -65,5 +65,5 @@ e8408d7808d4535e25ee9d55ac1e99ae350fdcb3 ./src/timebits.h
ef3526c8993eb84cb42bbd30b4b4d897aa595d56 ./src/translate.py
538872498e61b87cf08aa7265e1506648f35bde2 ./src/vars.cc
afbd6daec11670aca86a20b675e56651cf6ec33a ./src/vars.h
e8b4f9995052bec607bba47315109f332229ba78 ./src/version.h
98376c7c297b85d010b8d9e29c74ed6cf6d1afe9 ./src/version.inc
04e86fde014c236d9b1884b5705cdbe5c563a327 ./src/version.h
98376c7c297b85d02d1b5f32325bbd51ea9074e4 ./src/version.inc
Binary file modified bin/axis
Binary file not shown.
Binary file modified bin/axis.exe
Binary file not shown.
12 changes: 6 additions & 6 deletions sha1sums
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
d3211bc77e99c53b8c741e88c73aa027cd5d54f2 *./bin/axis
1a67b414a14eb798f34700352d746b64d9e9b6f7 *./bin/axis.exe
9be5b5a1d067f1f94a133b16ded8fdaa29365e3c *./bin/axis
f866701be1a6fc8e1acdc4ebe047c39e78ab821d *./bin/axis.exe
6d8f7d55f6243c2b43f0fb64ad22523bb271a6c8 *./bin/axisgui.py
04a02a05b856af499c7e12a4ca54b192f6ee8b1c *./LICENSE
f4b7439d3196b6ac2ecc57930853e8293736ce22 *./makefile
Expand All @@ -16,7 +16,7 @@ ab1f44390543c26b49b94eba1eb736b4cdc8702c *./src/axismain.cc
4a5d5ae6faa04225a35aa5751b290570a48809fb *./src/axisum.h
78882afd798f90d581c75347ebb9bfc1264dcd1c *./src/bnode.cc
da07eb161d5606ad1db49cd6e027b0fb095f7f30 *./src/bnode.h
d0944a4dd2ef98161ab9b37e997cd97526938251 *./src/build.inc
f6ea26d649e1cd8059632753db3b33fdaa6ef03e *./src/build.inc
01d7ae4d64aac4aa3a7cb5a34e5dd008b95058f0 *./src/buildinc
2a4ba2232e37cde6ccf4d85c0429bdb90081a687 *./src/canonicalize.cc
d3cdb3d4423c1dc67367029ba7d6c73f3d332eee *./src/canonicalize.h
Expand Down Expand Up @@ -51,7 +51,7 @@ a948a84493f5dc355b678e79b9008d7094ff85c1 *./src/hash.h
fcfe84ba2f191ef654d5cb65a99e92947f4e8ab2 *./src/makefile.mk
c139da5ddf1c747eee44e5aafee6eb312af3e29e *./src/mdirs.cc
7e2e741f8abec81de2f5372bb36963c67365267f *./src/mdirs.h
a90c050d31c4e21646de160b165a0d64133572e8 *./src/packer.cc
6baabc0a0d6aa476ad1ee442fed8a00cca2e81fc *./src/packer.cc
e9388d1b80ad9674d219e33c719f51a8db82946e *./src/packer.h
59f93ff4a50024bd34349b0c98d5b8f7fc8470e6 *./src/permutation.cc
69db3be840f0ce074cfd51731553ad680a8d14b7 *./src/permutation.h
Expand All @@ -65,5 +65,5 @@ d14f84cf902170ff48510ebaa4a7365b2525f8eb *./src/random.cc
55e7bb198358c358942c553bca178ad1658aa0d5 *./src/translate.py
46025207b186c68b74526686560ed72decb7d64e *./src/vars.cc
b496214fa6b932662b09dd09ab5d794359886ecd *./src/vars.h
a211c363366100e73d041459fc95353a04179bd5 *./src/version.h
405043c298646585673bee7c96ea442cef584fd9 *./src/version.inc
607caa3523ac00ed89cb83b9b81b0b1683c9d294 *./src/version.h
579cbde494c37440c75ebfb871c85d2b91ebe369 *./src/version.inc
2 changes: 1 addition & 1 deletion src/build.inc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
BUILD_NUMBER=657
BUILD_NUMBER=658
17 changes: 11 additions & 6 deletions src/packer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,30 +99,35 @@ bool packer::rbuf(void *file, uint8_t *c){
#define rc32_shift() low<<=8;if((uint32_t)((range<<=8)+low)<low) range=~low;

bool packer::rc32_getc(void *file, uint8_t *c, uint8_t cntx){
uint16_t *f=frequency[cntx],fc=fcs[cntx];
uint32_t s=0,i;
while(hlp<low||(low^(low+range))<0x1000000||range<0x10000){
hlp<<=8;
if(rbuf(file,hlpp)) return true;
if(!rpos) return false;
rc32_shift();
};
uint16_t *f=frequency[cntx],fc=fcs[cntx];
uint32_t i;
if((i=(hlp-low)/(range/=fc))>=fc) return true;
register uint32_t s=0;
while((s+=*f)<=i) f++;
low+=(s-*f)*range;
*c=(uint8_t)(f-frequency[cntx]);
rc32_rescale();
}

bool packer::rc32_putc(void *file, uint8_t c, uint8_t cntx){
uint16_t *f=frequency[cntx],fc=fcs[cntx];
uint32_t s=0,i=c;
while((low^(low+range))<0x1000000||range<0x10000){
if(!(wbuf(file,*lowp),wpos)) return true;
rc32_shift();
};
while(i--) s+=*f++;
low+=s*(range/=fc);
uint16_t *f=frequency[cntx],fc=fcs[cntx];
register uint64_t s=0;
while(c>3) s+=*(uint64_t *)f,f+=4,c-=4;
while(c>1) s+=*(uint32_t *)f,f+=2,c-=2;
while(c--) s+=*f++;
s+=s>>32;
s+=s>>16;
low+=((uint16_t)s)*(range/=fc);
rc32_rescale();
}

Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define VERSION "0.8.32 (build 657 2023-06-19)"
#define VERSION "0.8.33 (build 658 2023-06-26)"
2 changes: 1 addition & 1 deletion src/version.inc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION_STRING="0.8.32"
VERSION_STRING="0.8.33"

0 comments on commit 4a87b2f

Please sign in to comment.