]> gitweb.factorcode.org Git - factor.git/commitdiff
rename half-floats vocab to math.floats.half
authorJoe Groff <arcata@gmail.com>
Wed, 28 Apr 2010 22:48:47 +0000 (15:48 -0700)
committerJoe Groff <arcata@gmail.com>
Wed, 28 Apr 2010 22:48:47 +0000 (15:48 -0700)
basis/half-floats/authors.txt [deleted file]
basis/half-floats/half-floats-tests.factor [deleted file]
basis/half-floats/half-floats.factor [deleted file]
basis/half-floats/summary.txt [deleted file]
basis/images/normalization/normalization.factor
basis/math/floats/half/authors.txt [new file with mode: 0644]
basis/math/floats/half/half-tests.factor [new file with mode: 0644]
basis/math/floats/half/half.factor [new file with mode: 0644]
basis/math/floats/half/summary.txt [new file with mode: 0644]
extra/gpu/render/render.factor
extra/gpu/shaders/shaders.factor

diff --git a/basis/half-floats/authors.txt b/basis/half-floats/authors.txt
deleted file mode 100644 (file)
index f13c9c1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Joe Groff
diff --git a/basis/half-floats/half-floats-tests.factor b/basis/half-floats/half-floats-tests.factor
deleted file mode 100644 (file)
index d6b26cb..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-USING: accessors alien.c-types alien.syntax half-floats kernel
-math tools.test specialized-arrays alien.data classes.struct ;
-SPECIALIZED-ARRAY: half
-IN: half-floats.tests
-
-[ HEX: 0000 ] [  0.0  half>bits ] unit-test
-[ HEX: 8000 ] [ -0.0  half>bits ] unit-test
-[ HEX: 3e00 ] [  1.5  half>bits ] unit-test
-[ HEX: be00 ] [ -1.5  half>bits ] unit-test
-[ HEX: 7c00 ] [  1/0. half>bits ] unit-test
-[ HEX: fc00 ] [ -1/0. half>bits ] unit-test
-[ HEX: 7eaa ] [ NAN: aaaaaaaaaaaaa half>bits ] unit-test
-
-! too-big floats overflow to infinity
-[ HEX: 7c00 ] [   65536.0 half>bits ] unit-test
-[ HEX: fc00 ] [  -65536.0 half>bits ] unit-test
-[ HEX: 7c00 ] [  131072.0 half>bits ] unit-test
-[ HEX: fc00 ] [ -131072.0 half>bits ] unit-test
-
-! too-small floats flush to zero
-[ HEX: 0000 ] [  1.0e-9 half>bits ] unit-test
-[ HEX: 8000 ] [ -1.0e-9 half>bits ] unit-test
-
-[  0.0  ] [ HEX: 0000 bits>half ] unit-test
-[ -0.0  ] [ HEX: 8000 bits>half ] unit-test
-[  1.5  ] [ HEX: 3e00 bits>half ] unit-test
-[ -1.5  ] [ HEX: be00 bits>half ] unit-test
-[  1/0. ] [ HEX: 7c00 bits>half ] unit-test
-[ -1/0. ] [ HEX: fc00 bits>half ] unit-test
-[  3.0  ] [ HEX: 4200 bits>half ] unit-test
-[    t  ] [ HEX: 7e00 bits>half fp-nan? ] unit-test
-
-STRUCT: halves
-    { tom half }
-    { dick half }
-    { harry half }
-    { harry-jr half } ;
-
-[ 8 ] [ halves heap-size ] unit-test
-
-[ 3.0 ] [
-    halves <struct>
-        3.0 >>dick
-    dick>>
-] unit-test
-
-[ half-array{ 1.0 2.0 3.0 1/0. -1/0. } ]
-[ { 1.0 2.0 3.0 1/0. -1/0. } >half-array ] unit-test
-
diff --git a/basis/half-floats/half-floats.factor b/basis/half-floats/half-floats.factor
deleted file mode 100644 (file)
index 4c84bb8..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-! (c)2009 Joe Groff bsd license
-USING: accessors alien.accessors alien.c-types alien.data
-alien.syntax kernel math math.order ;
-FROM: math => float ;
-IN: half-floats
-
-: half>bits ( float -- bits )
-    float>bits
-    [ -31 shift 15 shift ] [
-        HEX: 7fffffff bitand
-        dup zero? [
-            dup HEX: 7f800000 >= [ -13 shift HEX: 7fff bitand ] [
-                -13 shift
-                112 10 shift -
-                0 HEX: 7c00 clamp
-            ] if
-        ] unless
-    ] bi bitor ;
-
-: bits>half ( bits -- float )
-    [ -15 shift 31 shift ] [
-        HEX: 7fff bitand
-        dup zero? [
-            dup HEX: 7c00 >= [ 13 shift HEX: 7f800000 bitor ] [
-                13 shift
-                112 23 shift + 
-            ] if
-        ] unless
-    ] bi bitor bits>float ;
-
-SYMBOL: half
-
-<<
-
-<c-type>
-    float >>class
-    float >>boxed-class
-    [ alien-unsigned-2 bits>half ] >>getter
-    [ [ >float half>bits ] 2dip set-alien-unsigned-2 ] >>setter
-    2 >>size
-    2 >>align
-    2 >>align-first
-    [ >float ] >>unboxer-quot
-\ half define-primitive-type
-
->>
diff --git a/basis/half-floats/summary.txt b/basis/half-floats/summary.txt
deleted file mode 100644 (file)
index b22448f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Half-precision float support for FFI
index 6eaca01e15c4bc3d24283c1d3c6be2619200bedc..db68e4bad6c2cf480befc59a6933fca0c6135eac 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien.c-types byte-arrays combinators fry
 grouping images kernel locals math math.vectors
-sequences specialized-arrays half-floats ;
+sequences specialized-arrays math.floats.half ;
 FROM: alien.c-types => float ;
 SPECIALIZED-ARRAY: half
 SPECIALIZED-ARRAY: float
diff --git a/basis/math/floats/half/authors.txt b/basis/math/floats/half/authors.txt
new file mode 100644 (file)
index 0000000..f13c9c1
--- /dev/null
@@ -0,0 +1 @@
+Joe Groff
diff --git a/basis/math/floats/half/half-tests.factor b/basis/math/floats/half/half-tests.factor
new file mode 100644 (file)
index 0000000..82db3d1
--- /dev/null
@@ -0,0 +1,49 @@
+USING: accessors alien.c-types alien.syntax math.floats.half kernel
+math tools.test specialized-arrays alien.data classes.struct ;
+SPECIALIZED-ARRAY: half
+IN: math.floats.half.tests
+
+[ HEX: 0000 ] [  0.0  half>bits ] unit-test
+[ HEX: 8000 ] [ -0.0  half>bits ] unit-test
+[ HEX: 3e00 ] [  1.5  half>bits ] unit-test
+[ HEX: be00 ] [ -1.5  half>bits ] unit-test
+[ HEX: 7c00 ] [  1/0. half>bits ] unit-test
+[ HEX: fc00 ] [ -1/0. half>bits ] unit-test
+[ HEX: 7eaa ] [ NAN: aaaaaaaaaaaaa half>bits ] unit-test
+
+! too-big floats overflow to infinity
+[ HEX: 7c00 ] [   65536.0 half>bits ] unit-test
+[ HEX: fc00 ] [  -65536.0 half>bits ] unit-test
+[ HEX: 7c00 ] [  131072.0 half>bits ] unit-test
+[ HEX: fc00 ] [ -131072.0 half>bits ] unit-test
+
+! too-small floats flush to zero
+[ HEX: 0000 ] [  1.0e-9 half>bits ] unit-test
+[ HEX: 8000 ] [ -1.0e-9 half>bits ] unit-test
+
+[  0.0  ] [ HEX: 0000 bits>half ] unit-test
+[ -0.0  ] [ HEX: 8000 bits>half ] unit-test
+[  1.5  ] [ HEX: 3e00 bits>half ] unit-test
+[ -1.5  ] [ HEX: be00 bits>half ] unit-test
+[  1/0. ] [ HEX: 7c00 bits>half ] unit-test
+[ -1/0. ] [ HEX: fc00 bits>half ] unit-test
+[  3.0  ] [ HEX: 4200 bits>half ] unit-test
+[    t  ] [ HEX: 7e00 bits>half fp-nan? ] unit-test
+
+STRUCT: halves
+    { tom half }
+    { dick half }
+    { harry half }
+    { harry-jr half } ;
+
+[ 8 ] [ halves heap-size ] unit-test
+
+[ 3.0 ] [
+    halves <struct>
+        3.0 >>dick
+    dick>>
+] unit-test
+
+[ half-array{ 1.0 2.0 3.0 1/0. -1/0. } ]
+[ { 1.0 2.0 3.0 1/0. -1/0. } >half-array ] unit-test
+
diff --git a/basis/math/floats/half/half.factor b/basis/math/floats/half/half.factor
new file mode 100644 (file)
index 0000000..ffa3550
--- /dev/null
@@ -0,0 +1,46 @@
+! (c)2009 Joe Groff bsd license
+USING: accessors alien.accessors alien.c-types alien.data
+alien.syntax kernel math math.order ;
+FROM: math => float ;
+IN: math.floats.half
+
+: half>bits ( float -- bits )
+    float>bits
+    [ -31 shift 15 shift ] [
+        HEX: 7fffffff bitand
+        dup zero? [
+            dup HEX: 7f800000 >= [ -13 shift HEX: 7fff bitand ] [
+                -13 shift
+                112 10 shift -
+                0 HEX: 7c00 clamp
+            ] if
+        ] unless
+    ] bi bitor ;
+
+: bits>half ( bits -- float )
+    [ -15 shift 31 shift ] [
+        HEX: 7fff bitand
+        dup zero? [
+            dup HEX: 7c00 >= [ 13 shift HEX: 7f800000 bitor ] [
+                13 shift
+                112 23 shift + 
+            ] if
+        ] unless
+    ] bi bitor bits>float ;
+
+SYMBOL: half
+
+<<
+
+<c-type>
+    float >>class
+    float >>boxed-class
+    [ alien-unsigned-2 bits>half ] >>getter
+    [ [ >float half>bits ] 2dip set-alien-unsigned-2 ] >>setter
+    2 >>size
+    2 >>align
+    2 >>align-first
+    [ >float ] >>unboxer-quot
+\ half define-primitive-type
+
+>>
diff --git a/basis/math/floats/half/summary.txt b/basis/math/floats/half/summary.txt
new file mode 100644 (file)
index 0000000..b22448f
--- /dev/null
@@ -0,0 +1 @@
+Half-precision float support for FFI
index 6e66832a2fbc4a0624cdda71278e75d3289fc65c..d1cb0357eddbc20e6cae87500251b5cb5edeece8 100755 (executable)
@@ -4,7 +4,7 @@ assocs classes classes.mixin classes.parser classes.singleton classes.struct
 classes.tuple classes.tuple.private combinators combinators.tuple destructors fry
 generic generic.parser gpu gpu.buffers gpu.framebuffers
 gpu.framebuffers.private gpu.shaders gpu.shaders.private gpu.state
-gpu.textures gpu.textures.private half-floats images kernel
+gpu.textures gpu.textures.private math.floats.half images kernel
 lexer locals math math.order math.parser namespaces opengl
 opengl.gl parser quotations sequences slots sorting
 specialized-arrays strings ui.gadgets.worlds variants
index 8a2931e4316e559a9d10bff25b01504ff9760d43..d1c137128aa254e212e18b797abce5e6f8e51e7f 100755 (executable)
@@ -8,7 +8,7 @@ kernel lexer literals locals math math.parser memoize multiline namespaces
 opengl opengl.gl opengl.shaders parser quotations sequences
 specialized-arrays splitting strings tr ui.gadgets.worlds
 variants vectors vocabs vocabs.loader vocabs.parser words
-words.constant half-floats typed ;
+words.constant math.floats.half typed ;
 QUALIFIED-WITH: alien.c-types c
 SPECIALIZED-ARRAY: int
 SPECIALIZED-ARRAY: void*