Displaying 2 results from an estimated 2 matches for "is_4byte_aligned".
2012 Feb 17
0
[LLVMdev] We need better hashing
On 17 February 2012 08:26, Talin <viridia at gmail.com> wrote:
> + // Helper class to detect if the input type is 4-byte aligned.
> + template<typename T>
> + struct is_4byte_aligned {
> + static const bool value = (sizeof(T) & 3) == 0;
> + };
I don't think this is safe, e.g. for:
struct {
char c[4];
}
Jay.
2012 Feb 17
4
[LLVMdev] We need better hashing
OK here's a patch with the latest, including unit tests. I've also tried to
make the comments clear that this is intended for the case of "generic" key
types, where you are either hashing multiple data types together, or you
don't know in advance what the data type will be - for cases such as
strings where a tailored algorithm is available, you should use that
instead of