diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2018-04-06 15:57:53 -0400 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-04-08 16:56:33 +0300 |
commit | 8a70e7cff55bd65cfd4399df878a16bbe1495782 (patch) | |
tree | be97054053d6ada3d073d33aa99ce824b4d52426 /mesonbuild/interpreter.py | |
parent | 23a7fe06e982fbe5d076153ef912cb3009eb1f3f (diff) | |
download | meson-8a70e7cff55bd65cfd4399df878a16bbe1495782.zip meson-8a70e7cff55bd65cfd4399df878a16bbe1495782.tar.gz meson-8a70e7cff55bd65cfd4399df878a16bbe1495782.tar.bz2 |
Remove arbitrary [-1024,1024] limit in cross_compute_int()
Copy the algorithm used by autoconf.
It computes the upper and lower limits by starting at [-1,1] and
multiply by 2 at each iteration. This is even faster for small numbers
(the common case), for example it finds value 0 in just 2 compilations
where old algorithm would check for 1024, 512, ..., 0.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r-- | mesonbuild/interpreter.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index b04d586..6e3b864 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -984,20 +984,20 @@ class CompilerHolder(InterpreterObject): check_stringlist(args) expression = args[0] prefix = kwargs.get('prefix', '') - l = kwargs.get('low', -1024) - h = kwargs.get('high', 1024) + low = kwargs.get('low', None) + high = kwargs.get('high', None) guess = kwargs.get('guess', None) if not isinstance(prefix, str): raise InterpreterException('Prefix argument of compute_int must be a string.') - if not isinstance(l, int): + if low is not None and not isinstance(low, int): raise InterpreterException('Low argument of compute_int must be an int.') - if not isinstance(h, int): + if high is not None and not isinstance(high, int): raise InterpreterException('High argument of compute_int must be an int.') if guess is not None and not isinstance(guess, int): raise InterpreterException('Guess argument of compute_int must be an int.') extra_args = self.determine_args(kwargs) deps = self.determine_dependencies(kwargs) - res = self.compiler.compute_int(expression, l, h, guess, prefix, self.environment, extra_args, deps) + res = self.compiler.compute_int(expression, low, high, guess, prefix, self.environment, extra_args, deps) mlog.log('Computing int of "%s": %d' % (expression, res)) return res |