I was bored last night, so I added single-precision float arrays to  
the VM. I called the class "sfloat-array", in a vocab "sfloat-arrays",  
and used lowercase f{ } for literal sfloat-array brackets. They look  
and act like good old double-precision float-arrays, including being  
transparent to the C interface, but use half the memory and have half  
the precision. Great for feeding video cards and vector units.

There were some bumps in the bootstrapping process that I had to sort  
of weasel my way around, and I'd like to know if there's a "right way  
to do it" I missed. In bootstrap.layouts, I say "IN: sfloat-arrays  
DEFER: sfloat-array" to create the sfloat-array word, because the  
layouts need to be defined before the builtin classes can be defined  
in bootstrap.primitives, which would be where the word for the class  
normally gets defined. Also, I had to avoid using f{ in sfloat-arrays,  
because the new syntax word gets created in stage1 by bootstrap.syntax  
but isn't actually defined until stage2 reloads the core syntax vocab.

And an unrelated question: why are byte-array, float-array, and bit- 
array implemented as separate primitive types in the VM? It seems like  
the latter two, and indeed any packed unboxed (c-type)-array, could be  
implemented in pure Factor on top of byte-array. I'm guessing  
efficiency has something to do with it.

-Joe

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to