From: zooko Date: Mon, 8 Sep 2008 18:11:51 +0000 (+0530) Subject: make the STRIDE settable at build-time with the "--stride=" option to "./setup.py... X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/flags/(%5B%5E?a=commitdiff_plain;h=887f86de49636cea9c8e87f99e9efb729a74dfc5;p=tahoe-lafs%2Fzfec.git make the STRIDE settable at build-time with the "--stride=" option to "./setup.py build" darcs-hash:ea947aeba28a1e301c3c52b79e7bfefcab907971 --- diff --git a/zfec/setup.py b/zfec/setup.py index 391c19c..451786e 100755 --- a/zfec/setup.py +++ b/zfec/setup.py @@ -34,8 +34,18 @@ extra_link_args=[] extra_compile_args.append("-std=c99") +define_macros=[] undef_macros=[] +for arg in sys.argv: + if arg.startswith("--STRIDE="): + stride = int(arg[len("--stride="):]) + define_macros.append(('STRIDE', stride)) + break + +sys.argv.remove(arg) + + if DEBUGMODE: extra_compile_args.append("-O0") extra_compile_args.append("-g") @@ -129,7 +139,7 @@ setup(name=PKG, setup_requires=setup_requires, classifiers=trove_classifiers, entry_points = { 'console_scripts': [ 'zfec = %s.cmdline_zfec:main' % PKG, 'zunfec = %s.cmdline_zunfec:main' % PKG ] }, - ext_modules=[Extension(PKG+'._fec', [PKG+'/fec.c', PKG+'/_fecmodule.c',], extra_link_args=extra_link_args, extra_compile_args=extra_compile_args, undef_macros=undef_macros),], + ext_modules=[Extension(PKG+'._fec', [PKG+'/fec.c', PKG+'/_fecmodule.c',], extra_link_args=extra_link_args, extra_compile_args=extra_compile_args, undef_macros=undef_macros, define_macros=define_macros),], test_suite=PKG+".test", zip_safe=False, # I prefer unzipped for easier access. ) diff --git a/zfec/zfec/fec.c b/zfec/zfec/fec.c index ba6e347..04a7132 100644 --- a/zfec/zfec/fec.c +++ b/zfec/zfec/fec.c @@ -458,7 +458,9 @@ fec_new(unsigned k, unsigned n) { /* To make sure that we stay within cache in the inner loops of fec_encode() and fec_decode(). */ +#ifndef STRIDE #define STRIDE 8192 +#endif void fec_encode(const fec_t* code, const gf*restrict const*restrict const src, gf*restrict const*restrict const fecs, const unsigned*restrict const block_nums, size_t num_block_nums, size_t sz) {