]> gitweb.factorcode.org Git - factor.git/commitdiff
math.vectors: remove special handling for negative shifts, now we just say the behavi...
authorSlava Pestov <slava@shill.local>
Sat, 26 Sep 2009 07:26:31 +0000 (02:26 -0500)
committerSlava Pestov <slava@shill.local>
Sat, 26 Sep 2009 07:26:31 +0000 (02:26 -0500)
basis/math/vectors/vectors-docs.factor
basis/math/vectors/vectors-tests.factor
basis/math/vectors/vectors.factor

index 252cc4216e70af547beafc579c70f255c0fe56c8..2d9a70ad58605775f396805827a1387c3f42def4 100644 (file)
@@ -209,11 +209,13 @@ HELP: vbitxor
 
 HELP: vlshift
 { $values { "u" "a sequence of integers" } { "n" "a non-negative integer" } { "w" "a sequence of integers" } }
-{ $description "Shifts each element of " { $snippet "u" } " to the left by " { $snippet "n" } " bits." } ;
+{ $description "Shifts each element of " { $snippet "u" } " to the left by " { $snippet "n" } " bits." }
+{ $notes "Undefined behavior will result if " { $snippet "n" } " is negative." } ;
 
 HELP: vrshift
 { $values { "u" "a sequence of integers" } { "n" "a non-negative integer" } { "w" "a sequence of integers" } }
-{ $description "Shifts each element of " { $snippet "u" } " to the right by " { $snippet "n" } " bits." } ;
+{ $description "Shifts each element of " { $snippet "u" } " to the right by " { $snippet "n" } " bits." }
+{ $notes "Undefined behavior will result if " { $snippet "n" } " is negative." } ;
 
 HELP: norm-sq
 { $values { "v" "a sequence of numbers" } { "x" "a non-negative real number" } }
index 712c5e4c6035aec10210f253709c91f04369fa71..91c5c0326f4d420e7d625aa27b7a69d9c463621e 100644 (file)
@@ -24,11 +24,3 @@ SPECIALIZED-ARRAY: int
 [ { 0 3 2 5 4 } ] [ { 1 2 3 4 5 } { 1 1 1 1 1 } v+- ] unit-test
 
 [ 1 ] [ { C{ 0 1 } } dup v. ] unit-test
-
-! Make sure vector shifts behave the same as hardware SIMD vector shifts
-[ int-array{ 0 0 0 0 } ] [ int-array{ 10 20 30 40 } -1 vlshift ] unit-test
-
-[ int-array{ 0 0 0 0 } ] [
-    int-array{ 10 20 30 40 }
-    [ { int-array } declare -1 vlshift ] compile-call
-] unit-test
\ No newline at end of file
index e3e4f51e287cf16a71deef4aa235c5c039fa98b5..a40506f98014f82cc9f99e9b45710a9dc346aec8 100644 (file)
@@ -61,8 +61,8 @@ PRIVATE>
 : vbitor ( u v -- w ) over '[ _ [ bitor ] fp-bitwise-op ] 2map ;
 : vbitxor ( u v -- w ) over '[ _ [ bitxor ] fp-bitwise-op ] 2map ;
 
-: vlshift ( u n -- w ) HEX: ffffffff bitand '[ _ shift ] map ;
-: vrshift ( u n -- w ) HEX: ffffffff bitand neg '[ _ shift ] map ;
+: vlshift ( u n -- w ) '[ _ shift ] map ;
+: vrshift ( u n -- w ) neg '[ _ shift ] map ;
 
 : vfloor    ( u -- v ) [ floor ] map ;
 : vceiling  ( u -- v ) [ ceiling ] map ;