[LLVMdev] We need better hashing

Jay Foad jay.foad at gmail.com
Fri Feb 17 01:03:06 PST 2012


On 17 February 2012 08:56, Jay Foad <jay.foad at gmail.com> wrote:
> 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];
> }

... so you should probably use the stuff in <llvm/Support/AlignOf.h> instead!

Jay.




More information about the llvm-dev mailing list