From: Jay Freeman (saurik) Date: Tue, 17 Nov 2009 06:01:40 +0000 (+0000) Subject: Crazy variable naming optimization of doom. X-Git-Tag: v0.9.432~153 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/45d0c9280a745011b91c8bf4d48ffc8d79a51b07?ds=sidebyside Crazy variable naming optimization of doom. --- diff --git a/Replace.cpp b/Replace.cpp index 45be919..d44374e 100644 --- a/Replace.cpp +++ b/Replace.cpp @@ -456,6 +456,8 @@ CYExpression *CYPrefix::Replace(CYContext &context) { return this; } +#define MappingSet "0etnirsoalfucdphmgyvbxTwSNECAFjDLkMOIBPqzRH$_WXUVGYKQJZ" + void CYProgram::Replace(CYContext &context) { parent_ = context.scope_; CYProgram *program(context.program_); @@ -489,9 +491,9 @@ void CYProgram::Replace(CYContext &context) { unsigned position(7), local(offset + 1); do { - unsigned index(local % 53); - local /= 53; - id[--position] = index == 0 ? '0' : index < 27 ? index - 1 + 'a' : index - 27 + 'A'; + unsigned index(local % (sizeof(MappingSet) - 1)); + local /= sizeof(MappingSet) - 1; + id[--position] = MappingSet[index]; } while (local != 0); if (external.find(id + position) != external.end()) { diff --git a/makefile b/makefile index 551bd73..0e33e07 100644 --- a/makefile +++ b/makefile @@ -143,7 +143,7 @@ package: $(deb) test: $(deb) dpkg -i $(deb) if [[ -e target.cy ]]; then cycript -c target.cy && echo; fi - if [[ -e jquery.js ]]; then /usr/bin/time cycript -c jquery.js >jquery.cyc.js; gzip -9c jquery.cyc.js >jquery.cyc.js.gz; wc -c jquery.{mam,gcc,cyc,bak,yui}.js; wc -c jquery.{gcc,cyc,bak,mam,yui}.js.gz; fi + if [[ -e jquery.js ]]; then /usr/bin/time cycript -c jquery.js >jquery.cyc.js; gzip -9c jquery.cyc.js >jquery.cyc.js.gz; wc -c jquery.{mam,gcc,cyc,bak,yui}.js; wc -c jquery.{cyc,gcc,bak,mam,yui}.js.gz; fi if [[ -e test.cy ]]; then cycript test.cy; fi .PHONY: all clean extra package control.tmp