Changeset View
Changeset View
Standalone View
Standalone View
analitza/additionchains.h
Show All 15 Lines | |||||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * | ||
17 | *************************************************************************************/ | 17 | *************************************************************************************/ | ||
18 | 18 | | |||
19 | #ifndef ADDITIONCHAINS_H | 19 | #ifndef ADDITIONCHAINS_H | ||
20 | #define ADDITIONCHAINS_H | 20 | #define ADDITIONCHAINS_H | ||
21 | 21 | | |||
22 | //NOTE this code generates the whole thing ... | 22 | //NOTE this code generates the whole thing ... | ||
23 | // see seq function in | 23 | // see seq function in | ||
24 | // http://rosettacode.org/wiki/Addition-chain_exponentiation/Achain.c or | 24 | // https://rosettacode.org/wiki/Addition-chain_exponentiation/Achain.c or | ||
25 | // http://www-cs-faculty.stanford.edu/~knuth/programs/achain4.w | 25 | // https://www-cs-faculty.stanford.edu/~knuth/programs/achain4.w | ||
26 | // int main(int argc, char *argv[]) | 26 | // int main(int argc, char *argv[]) | ||
27 | // { | 27 | // { | ||
28 | // const int MAX_N = 2048; | 28 | // const int MAX_N = 2048; | ||
29 | // const int MAX_LEN = 15; | 29 | // const int MAX_LEN = 15; | ||
30 | // const int MAX_COL = MAX_LEN+1; | 30 | // const int MAX_COL = MAX_LEN+1; | ||
31 | // // seq len of max(1,2,...,MAX_N) is MAX_LEN but we need one additional slot for len (length) info (at 0) so we need MAX_COL cols | 31 | // // seq len of max(1,2,...,MAX_N) is MAX_LEN but we need one additional slot for len (length) info (at 0) so we need MAX_COL cols | ||
32 | // int buffer[MAX_N+1] = {0}; | 32 | // int buffer[MAX_N+1] = {0}; | ||
33 | // | 33 | // | ||
▲ Show 20 Lines • Show All 2078 Lines • Show Last 20 Lines |