The ffi's "memset" operation takes an optional "type" argument, but it's not clear what happens if the type isn't _byte. Here are the docs:
(memset cptr byte count [type]) → void? cptr : cpointer? byte : byte? count : exact-nonnegative-integer? type : ctype? = _byte (memset cptr offset byte count [type]) → void? cptr : cpointer? offset : exact-integer? byte : byte? count : exact-nonnegative-integer? type : ctype? = _byte Similar to memmove, but the destination is uniformly filled with byte (i.e., an exact integer between 0 and 255 inclusive). So, if I run this code: #lang racket (require ffi/unsafe ffi/cvector) (define buf (cvector _float 0.0 0.0 0.0 0.0)) (memset (cvector-ptr buf) #x13 4 _float) (cvector->list buf) ... it's not obvious from the docs whether I'm going to get memory containing #x13131313131313131313131313131313 or #x13000000130000001300000013000000 (or some other endian-ness). Based on my experiments, the answer is the former; that is, a type is simply used to multiply the number of bytes that need to be set. Okay then to modify the docs as follows? "Similar to memmove, but the destination is uniformly filled with byte (i.e., an exact integer between 0 and 255 inclusive). If a "type" argument is present, the result is the same as calling memmove with no type argument where the count multiplied by the size in bytes of the given type." Klunky, but gets the job done. John
smime.p7s
Description: S/MIME cryptographic signature
_________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev