Enable selection of high precision int64x64 implementation at configure time.
This commit is contained in:
@@ -22,7 +22,9 @@ Supported platforms
|
||||
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.
|
||||
|
||||
|
||||
@@ -4,14 +4,38 @@ import sys
|
||||
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 options(opt):
|
||||
|
||||
|
||||
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')
|
||||
|
||||
Reference in New Issue
Block a user