]> gitweb.factorcode.org Git - factor.git/commitdiff
shift now behaves correctly with large right shift'
authorSlava Pestov <slava@factorcode.org>
Sun, 5 Sep 2004 04:06:09 +0000 (04:06 +0000)
committerSlava Pestov <slava@factorcode.org>
Sun, 5 Sep 2004 04:06:09 +0000 (04:06 +0000)
Makefile
TODO.FACTOR.txt
library/image.factor
library/test/image.factor [new file with mode: 0644]
library/test/test.factor
native/fixnum.c

index 95a2560c88975f0843996ea6f824dc6c5cc44b87..0b3a254adc11b7485056de0810e697cfe4e38fed 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 CC = gcc
-CFLAGS = -Os -mpentiumpro -g -Wall
+CFLAGS = -Os -g -Wall
 LIBS = -lm
 STRIP = strip
 
index b1e6595789fadfe3e2c1e1414cccebf08a6d8287..14dc94dbfea4a12490c765749ec0035077fec2e1 100644 (file)
@@ -5,12 +5,13 @@
 - don't show listener on certain commands\r
 - plugin should not exit jEdit on fatal errors\r
 - wordpreview: don't show for string literals and comments\r
-- 64 bit support\r
 - alist -vs- assoc terminology\r
 - clean up listener's action popups\r
 - jedit ==> jedit-word, jedit takes a file name\r
 - introduce ifte* and ?str-head/?str-tail where appropriate\r
 - namespace clone drops static var bindings\r
+- solaris: -lsocket -lnsl\r
+- unparsing: \u000c\r
 \r
 + bignums:\r
 \r
index c35934da7e5276324b5c7eb48a0c05c5b36e8cb0..5a478d035a6b07b061a1bc3f17d6c4399b64f687 100644 (file)
@@ -125,11 +125,11 @@ USE: words
     object-tag here-as >r
     bignum-type >header emit
     dup 0 = 1 2 ? emit ( capacity )
-    dup 0 < [
-        1 emit neg emit
-    ] [
-        0 emit     emit
-    ] ifte r> ;
+    [
+        [ 0 = ] [ emit pad ]
+        [ 0 < ] [ 1 emit neg emit ]
+        [ 0 > ] [ 0 emit     emit ]
+    ] cond r> ;
 
 ( Special objects )
 
@@ -214,7 +214,7 @@ DEFER: '
 : (pack-string) ( n list -- )
     #! Emit bytes for a string, with n characters per word.
     [
-        2dup str-length > [ dupd .s align-string ] when
+        2dup str-length > [ dupd align-string ] when
         emit-string
     ] each drop ;
 
diff --git a/library/test/image.factor b/library/test/image.factor
new file mode 100644 (file)
index 0000000..269ead7
--- /dev/null
@@ -0,0 +1,23 @@
+USE: test
+USE: cross-compiler
+USE: namespaces
+USE: stdio
+
+[ "ab\0\0" ] [ 4 "ab" align-string ] unit-test
+
+[ { 0 } ] [
+    [ "\0\0\0\0" emit-string ] with-minimal-image
+] unit-test
+
+[ { 6815845 7077996 7274528 7798895 7471212 6553600 } ]
+[
+    [
+        "big-endian" on
+        [ "hello world" pack-string ] with-minimal-image
+    ] with-scope
+] unit-test
+
+[ "\0\0\0\0\u000f\u000e\r\u000c" ]
+[
+    [ image-magic write-big-endian-64 ] with-string
+] unit-test
index 65ee9ada209d478af202e0faf3c3e34735c0e7bd..3304914651f29ddfe94eee8a5f09c266d7b88b3b 100644 (file)
@@ -78,6 +78,7 @@ USE: unparser
         "parser"
         "parse-number"
         "prettyprint"
+        "image"
         "inspector"
         "io/io"
         "vectors"
index ac1e1468d28b510fea1df4fc5590b31d2aaa832a..da2b80c449ae519d991b9808f2d9a8f4f1012b70 100644 (file)
@@ -170,7 +170,12 @@ CELL xor_fixnum(FIXNUM x, FIXNUM y)
 CELL shift_fixnum(FIXNUM x, FIXNUM y)
 {
        if(y < 0)
-               return tag_fixnum(x >> -y);
+       {
+               if(y <= -WORD_SIZE)
+                       return (x < 0 ? tag_fixnum(-1) : tag_fixnum(0));
+               else
+                       return tag_fixnum(x >> -y);
+       }
        else if(y == 0)
                return tag_fixnum(x);
        else if(y < WORD_SIZE - TAG_BITS)