From 52f2ac2bb9459162ed76281259b4e5db09903353 Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Mon, 25 Jan 2010 20:15:17 -0600 Subject: [PATCH] Tests for propagation additions; making fixnum-bit? inline --- .../tree/propagation/propagation-tests.factor | 12 +++++++++++- core/math/integers/integers.factor | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/basis/compiler/tree/propagation/propagation-tests.factor b/basis/compiler/tree/propagation/propagation-tests.factor index ad17ccc1c9..e2bfe58788 100644 --- a/basis/compiler/tree/propagation/propagation-tests.factor +++ b/basis/compiler/tree/propagation/propagation-tests.factor @@ -8,7 +8,7 @@ layouts compiler.tree.propagation.info compiler.tree.def-use compiler.tree.debugger compiler.tree.checker slots.private words hashtables classes assocs locals specialized-arrays system sorting math.libm math.floats.private math.integers.private -math.intervals quotations effects alien alien.data ; +math.intervals quotations effects alien alien.data sets ; FROM: math => float ; SPECIALIZED-ARRAY: double SPECIALIZED-ARRAY: void* @@ -952,3 +952,13 @@ M: tuple-with-read-only-slot clone ! Reduction [ 1 ] [ [ 4 [ nth-unsafe ] [ ] unless ] final-info length ] unit-test + +! Optimization on bit? +[ t ] [ [ 3 bit? ] { bit? fixnum-bit? } inlined? ] unit-test +[ f ] [ [ 500 bit? ] { bit? fixnum-bit? } inlined? ] unit-test + +[ t ] [ [ { 1 } intersect ] { intersect } inlined? ] unit-test +[ f ] [ [ { 1 } swap intersect ] { intersect } inlined? ] unit-test ! We could do this + +[ t ] [ [ { 1 } diff ] { diff } inlined? ] unit-test +[ f ] [ [ { 1 } swap diff ] { diff } inlined? ] unit-test ! We could do this diff --git a/core/math/integers/integers.factor b/core/math/integers/integers.factor index 9f7543ca13..5f461e22a3 100644 --- a/core/math/integers/integers.factor +++ b/core/math/integers/integers.factor @@ -59,7 +59,7 @@ M: fixnum shift >fixnum fixnum-shift ; inline M: fixnum bitnot fixnum-bitnot ; inline : fixnum-bit? ( n m -- b ) - neg shift 1 bitand 0 > ; + neg shift 1 bitand 0 > ; inline M: fixnum bit? fixnum-bit? ; inline -- 2.34.1