[gambit-list] Fast conversion of vectors?

Hans Petter Egesund petter.egesund at gmail.com
Mon Jan 19 09:40:44 EST 2009


It seems a little like cheating but that is probably what I asked  
for. Thanks!

Petter


Den 18. jan. 2009 kl. 22.35 skrev Christian Jaeger:

> Petter Egesund wrote:
>> Hi, I wonder:
>>
>> Is there a way to "cast" a u32vector to a u8vector (except for
>> creating a new one and writing to this)?
>>
>> The reason I would like to do this is that u8vectors seems to be the
>> fastest way to write to disk; read-subu8vector and write-subu8vector.
>>
>
> http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php/ 
> Namespaces#Access_to_Gambit_internals
>
> ##write-subu8vector
>
> Of course the byte order in the file will be cpu endianness dependent.
>
> Re-tagging vectors to be of different type is also possible using
> lowlevel ops, but why not go with the above.
>
>> I could off course do this in C using the FFI, but I am not sure if
>> the garbage-collector might suprise me if I tried this?
>>
>
> Currently not for the time span during which you don't leave C. Be
> prepared for possible changes with future Gambit versions then,  
> though.
>
>> Is there a canonical way?
>>
>
> Currently the only canonical way would be to use the ffi with buffers
> allocated in C.
>
> Christian.
>




More information about the Gambit-list mailing list