Hi I need a 128 bit int-like data type. I was told to use code like this:
Apparently the compiler will know it's 128 bits at compile-time? Anyways, what's the most elegant way to represent 128-bit array? ThanksCode:uchar hash[0];
Hi I need a 128 bit int-like data type. I was told to use code like this:
Apparently the compiler will know it's 128 bits at compile-time? Anyways, what's the most elegant way to represent 128-bit array? ThanksCode:uchar hash[0];
Hah. uchar is one byte, not sixteen. Maybe you were told to use uchar hash[16].
Anyway, if there is a built-in type, check stdint.h; you'll see a uint128_t (note: you almost certainly won't). Otherwise, you'll have to make an array of the right length yourself. (Which data type you use depends on why you want 128-bits. If you're going to do things on a byte-by-byte basis, uchar is fine; if you plan to do some math, using the natural int might be a better choice.)
okay. I actually misinterpreted the semantics of the code. I was actually told to use
as a pointer, and then use that to malloc 128 bits. Apparently it's more proper than a (void *)...Code:uchar hash_code[0];
If you want a pointer, declare a pointer, not an array of size 0.
"No-one else has reported this problem, you're either crazy or a liar" - Dogbert Technical Support
"Have you tried turning it off and on again?" - The IT Crowd