diff --git a/basis/compiler/tests/optimizer.factor b/basis/compiler/tests/optimizer.factor index c3fd37c48a..ac86519919 100644 --- a/basis/compiler/tests/optimizer.factor +++ b/basis/compiler/tests/optimizer.factor @@ -155,6 +155,8 @@ GENERIC: void-generic ( obj -- * ) [ 0 ] [ 5 [ 1 mod ] compile-call ] unit-test [ 0 ] [ 5 [ 1 rem ] compile-call ] unit-test +[ 0.5 ] [ 5.5 [ 1 mod ] compile-call ] unit-test +[ 0.5 ] [ 5.5 [ 1 rem ] compile-call ] unit-test [ 5 ] [ 5 [ -1 bitand ] compile-call ] unit-test [ 0 ] [ 5 [ 0 bitand ] compile-call ] unit-test diff --git a/basis/compiler/tree/propagation/transforms/transforms.factor b/basis/compiler/tree/propagation/transforms/transforms.factor index 28de7abd4b..5c3d62477d 100644 --- a/basis/compiler/tree/propagation/transforms/transforms.factor +++ b/basis/compiler/tree/propagation/transforms/transforms.factor @@ -1,4 +1,4 @@ -! Copyright (C) 2008, 2010 Slava Pestov, Daniel Ehrenberg. +! Copyright (C) 2008, 2011 Slava Pestov, Daniel Ehrenberg. ! See http://factorcode.org/license.txt for BSD license. USING: alien.c-types kernel sequences words fry generic generic.single accessors classes.tuple classes classes.algebra @@ -23,9 +23,11 @@ IN: compiler.tree.propagation.transforms ] [ drop f ] if ] "custom-inlining" set-word-prop -: rem-custom-inlining ( #call -- quot/f ) - second value-info literal>> dup integer? - [ power-of-2? [ 1 - bitand ] f ? ] [ drop f ] if ; +: rem-custom-inlining ( inputs -- quot/f ) + dup first value-info class integer class<= [ + second value-info literal>> dup integer? + [ power-of-2? [ 1 - bitand ] f ? ] [ drop f ] if + ] [ drop f ] if ; { mod-integer-integer