Enable selection of high precision int64x64 implementation at configure time.
--- a/RELEASE_NOTES Sun Jan 26 18:22:04 2014 +0100
+++ b/RELEASE_NOTES Tue Jan 28 12:51:47 2014 -0800
@@ -22,7 +22,9 @@
New user-visible features
-------------------------
-- a new LTE MAC downlink scheduling algorithm named Channel and QoS
+- Enable selection of high precision int64x64_t implementation
+ at configure time, for debugging purposes.
+- A new LTE MAC downlink scheduling algorithm named Channel and QoS
Aware (CQA) Scheduler is provided by the new
``ns3::CqaFfMacScheduler`` object.
--- a/src/core/wscript Sun Jan 26 18:22:04 2014 +0100
+++ b/src/core/wscript Tue Jan 28 12:51:47 2014 -0800
@@ -4,14 +4,38 @@
from waflib import Options
import wutils
+int64x64 = {
+ # implementation name: [define, env, highprec]
+ 'default': ['INT64X64_USE_128', 'INT64X64_USE_128', '128-bit integer'],
+ 'int128': ['INT64X64_USE_128', 'INT64X64_USE_128', '128-bit integer'],
+ 'cairo': ['INT64X64_USE_CAIRO', 'INT64X64_USE_CAIRO', 'cairo 128-bit integer'],
+ 'double': ['INT64X64_USE_DOUBLE', 'INT64X64_USE_DOUBLE', 'long double'],
+ }
+
+default_int64x64 = 'default'
+
def options(opt):
- opt.add_option('--int64x64-as-double',
- help=('Whether to use a double floating point'
- ' type for int64x64 values'
- ' WARNING: this option only has effect '
- 'with the configure command.'),
- action="store_true", default=False,
- dest='int64x64_as_double')
+ assert default_int64x64 in int64x64
+ opt.add_option('--int64x64',
+ action='store',
+ default=default_int64x64,
+ help=("Force the choice of int64x64_t implementation "
+ "(normally only for debugging). "
+ "The supported implementations use int128_t, "
+ "cairo_int128, or long double. "
+ "The int128_t implementation (the preferred option) "
+ "requires compiler support. "
+ "The cairo implementation fallback provides exactly "
+ "the same numerical results, but possibly at lower "
+ "execution speed. The long double implementation "
+ "may not provide the same numerical results because "
+ "the implementation-defined numerical precision may "
+ "be less than the other implementations. "
+ "[Allowed Values: %s]"
+ % ", ".join([repr(p) for p in int64x64.keys()])),
+ choices=int64x64.keys(),
+ dest='int64x64_impl')
+
opt.add_option('--disable-pthread',
help=('Whether to enable the use of POSIX threads'),
action="store_true", default=False,
@@ -20,23 +44,24 @@
def configure(conf):
- a = conf.check_nonfatal(type_name='uint128_t', define_name='HAVE_UINT128_T')
- b = conf.check_nonfatal(type_name='__uint128_t', define_name='HAVE___UINT128_T')
-
- if Options.options.int64x64_as_double:
- conf.define('INT64X64_USE_DOUBLE', 1)
- conf.env['INT64X64_USE_DOUBLE'] = 1
- highprec = 'long double'
- elif a or b:
- conf.define('INT64X64_USE_128', 1)
- conf.env['INT64X64_USE_128'] = 1
- highprec = '128-bit integer'
- else:
- conf.define('INT64X64_USE_CAIRO', 1)
- conf.env['INT64X64_USE_CAIRO'] = 1
- highprec = 'cairo 128-bit integer'
-
- conf.msg('Checking high precision time implementation', highprec)
+ int64x64_impl = Options.options.int64x64_impl
+ if int64x64_impl == 'default' or int64x64_impl == 'int128':
+ have_uint128 = conf.check_nonfatal(type_name='uint128_t',
+ define_name='HAVE_UINT128_T')
+ have__uint128 = conf.check_nonfatal(type_name='__uint128_t',
+ define_name='HAVE___UINT128_T')
+ if have_uint128 or have__uint128:
+ int64x64_impl = 'int128'
+ else:
+ int64x64_impl = 'cairo'
+
+ def_flag, env_flag, highprec = int64x64[int64x64_impl]
+ # Add a tag confirming default choice
+ if Options.options.int64x64_impl == 'default':
+ highprec += ' (default)'
+ conf.define(def_flag, 1)
+ conf.env[env_flag] = 1
+ conf.msg('Checking high precision implementation', highprec)
conf.check_nonfatal(header_name='stdint.h', define_name='HAVE_STDINT_H')
conf.check_nonfatal(header_name='inttypes.h', define_name='HAVE_INTTYPES_H')