Writing make-sized-byte-string alternative on CS

25 views
Skip to first unread message

Sage Gerard

unread,
Sep 15, 2020, 5:12:30 PM9/15/20
to Racket Users
The docs for make-sized-byte-string indicate that CS does not support this operation. I'm guessing I just need to fall back to building a loop using ptr-ref, but is there something about CS that would prevent me from doing that too?

~slg


Matthew Flatt

unread,
Sep 15, 2020, 5:15:33 PM9/15/20
to Sage Gerard, Racket Users
You use `make-bytes` and `memcpy`, instead of writing a new loop. (The
non-copying part of `make-sized-byte-string` is what CS can't support.)

Matthew

At Tue, 15 Sep 2020 21:12:22 +0000, Sage Gerard wrote:
> The docs for
> [make-sized-byte-string](https://docs.racket-lang.org/foreign/foreign_pointer-f
> uncs.html?q=free#%28def._%28%28quote._~23~25foreign%29._make-sized-byte-string%
> 29%29) indicate that CS does not support this operation. I'm guessing I just
> need to fall back to building a loop using ptr-ref, but is there something
> about CS that would prevent me from doing that too?
>
> ~slg
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/P-nFrHLWq2Hs3MxhcsA09NoQtGaw0LfG
> 5WE-nC_IHWGSl3rPhToCquz8spEVDUAqg-LJRYweeGmerH12XTUUFhXBOHgBDAabpQk-2b2gFiQ%3D%
> 40sagegerard.com.

Sage Gerard

unread,
Sep 15, 2020, 5:17:37 PM9/15/20
to Matthew Flatt, Racket Users
Thank you for the rapid response!


~slg

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Tuesday, September 15, 2020 5:15 PM, Matthew Flatt <mfl...@cs.utah.edu> wrote:

> You use `make-bytes` and `memcpy`, instead of writing a new loop. (The
> non-copying part of `make-sized-byte-string` is what CS can't support.)
>
> Matthew
>
> At Tue, 15 Sep 2020 21:12:22 +0000, Sage Gerard wrote:
>
> > The docs for
> > [make-sized-byte-string](https://docs.racket-lang.org/foreign/foreign_pointer-f
> > uncs.html?q=free#%28def.%28%28quote.~23~25foreign%29._make-sized-byte-string%
> > 29%29) indicate that CS does not support this operation. I'm guessing I just
> > need to fall back to building a loop using ptr-ref, but is there something
> > about CS that would prevent me from doing that too?
> > ~slg
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to racket-users...@googlegroups.com.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/racket-users/P-nFrHLWq2Hs3MxhcsA09NoQtGaw0LfG
> > 5WE-nC_IHWGSl3rPhToCquz8spEVDUAqg-LJRYweeGmerH12XTUUFhXBOHgBDAabpQk-2b2gFiQ%3D%
> > 40sagegerard.com.
>
> --
>
> You received this message because you are subscribed to the Google Groups "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/20200915151528.252%40sirmail.smtps.cs.utah.edu.


Reply all
Reply to author
Forward
0 new messages