[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
packed structures usefulness
From: |
Marco Maggi |
Subject: |
packed structures usefulness |
Date: |
Fri, 2 Nov 2007 09:12:05 +0100 |
Ciao,
I am in the position to add, with relatively
little effort, a module to GEE to handle
packed data structures. This means that,
as example of a still unimplemented API, doing:
(define *triplet*
(make-gstruct-type '((one . int)
(two . double)
(three . (int64 . 3)))))
(define S (make-gstruct *triplet*))
(set! (one S) 123)
(set! (two S) 1.2)
(set! (three S 2) 44)
one can define a SMOB whose internal
representation is equivalent to the C language
type:
struct triplet {
int one;
double two;
int64_t three[3];
};
and then access its fields.
Remembering that, IMHO, there is no way to
mimic the C structure fields alignment from a
Scheme level inteface, I wonder if such a module
would be useful or not.
The conversion between Scheme level values and
C level values takes time, so I am not sure about
the value of the reduced memory usage.
Notice that I have already written a module
to implement variable-length vectors of C language
types, so that way of saving memory is already
available to me.
--
Marco Maggi
"Now feel the funk blast!"
Rage Against the Machine - "Calm like a bomb"
- packed structures usefulness,
Marco Maggi <=