Re: I wonder if I'm missing something...
"David McClain (as dbm at refined-audiometrics dot com)" <[email protected]>
| Newsgroups | gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <[email protected]> |
All good points from Martin. Not to mention the non-portable nature of proposed solutions, even if they would have worked. I’m finally coming around to the position that Streams should be only byte oriented. And that, if you need to convert aggregate types on input/output, we should use Martin’s suggested COPY-BYTE-VEC-TO-FPVEC, or similar. But lots of good learning happened from this venture. > On Nov 10, 2025, at 08:32, Martin Simmons <[email protected]> wrote: > > One reason for not allowing this is alignment constraints. Some (mostly > older) CPU architectures require alignment of memory to match the size of > access, so you can't just read a 4 byte single-float from an arbitrarily > aligned 4 bytes of memory. > > That is why system:typed-aref uses a double-float vector underneath, because > double-float is the only array type in 32-bit LispWorks that is aligned on 8 > bytes. > > -- > Martin Simmons > LispWorks Ltd > http://www.lispworks.com/ > > > >>>>>> On Fri, 7 Nov 2025 15:46:38 -0700, David McClain (as dbm at refined-audiometrics dot com) said: >> >>> Also when creating a displaced array it should allow casting to a different type. >>> >> >> +1 >> >> >> >> >>> On Nov 7, 2025, at 13:01, Yuri Davidovsky (as work at disclosure dot ie) <[email protected]> wrote: >>> >>> >>> >>>> On 7 Nov 2025, at 20:21, Tim Bradshaw <[email protected]> wrote: >>>> >>>> Here is a sketch (which I may have mentioned here previously) of how functionality could be added to CL which would enable fast I/O of, for instance, vectors of floats without destroying the language by allowing arbitrary type punning, and also dealing with things like ensuring things are written in defined byte orders. >>> >>> Interesting. I was thinking of something different. Essentially any byte stream could be read (and written to) arbitrary data types using primitives like: >>> >>> (read-byte stream) — as is now. >>> (read-byte stream :uint32) — will read an unsigned 32 bit int. >>> (read-byte stream :float) — you start to get the idea. >>> >>> You could do the same with read-sequence by supplying the type of data to read and an array of appropriate type. It should also support custom data types. >>> >>> Also when creating a displaced array it should allow casting to a different type. >>> >>> _______________________________________________ >>> Lisp Hug - the mailing list for LispWorks users >>> [email protected] >>> http://www.lispworks.com/support/lisp-hug.html >> >> >> _______________________________________________ >> Lisp Hug - the mailing list for LispWorks users >> [email protected] >> http://www.lispworks.com/support/lisp-hug.html >> > > _______________________________________________ > Lisp Hug - the mailing list for LispWorks users > [email protected] > http://www.lispworks.com/support/lisp-hug.html _______________________________________________ Lisp Hug - the mailing list for LispWorks users [email protected] http://www.lispworks.com/support/lisp-hug.html