Hi,
I apologise for starting a new thread on a partially answered question.
My previous problem has gotten more serious :)
So I have a function defined as follows:
bool observe(const WordID* dataword);
where WordID is
typedef uint32_t WordID;
My purpose is to use this function with some different data I already
have: the problem is, this data is NOT in the WordID format.
What I have is *pairs* of values, that I would like to input together
into observe(). In other words, I have pairs of numbers whose type is size_t
(size_t, size_t), (size_t, size_t), ... etc.
How can I input one of these pairs into observe()? I've heard that on
gcc size_t can be bigger than one uint32_t, so stuffing two into that
would definitely be a problem. What if I redefine the typedef such that
WordID is
typedef uint64_t WordID;
? And then maybe I could concatenate the two size_t and cast them into
that uint64_t? Would a uint64_t be enough? I was thinking about this:
observe(uint64_t* wordid);
and then
uint64_t chain(uint32_t one, uint32_t two) {
// get two 32bit rands and concatenate
uint64_t longrand = one;
longrand <<= 32;
longrand |= two;
return longrand;
}
The problem is this is a global typedef, used by many more function and
I'm not sure if this would harm something.
Any ideas would be greatly appreciated.
Cheers
Giuseppe