PDA

View Full Version : Data Alignment in QT ?



Thành Viên Mới
14th July 2010, 10:36
i want build VMAC ,but it use Data Alignment in Code
Ex:



int main(void)
{
ALIGN(16) vmac_ctx_t ctx, ctx_aio, ctx_inc1, ctx_inc2;
uint64_t res, tagl;
void *p;
unsigned char *m;
ALIGN(4) unsigned char key[] = "abcdefghijklmnop";
ALIGN(4) unsigned char nonce[] = "\0\0\0\0\0\0\0\0bcdefghi";
unsigned int vector_lengths[] = {0,3,48,300,3000000};
#if (VMAC_TAG_LEN == 64)
ALIGN(4) char *should_be[] = {"2576BE1C56D8B81B","2D376CF5B1813CE5",
"E8421F61D573D298","4492DF6C5CAC1BBE",
"09BA597DD7601113"};



can you help find Define ALIGN(16) in QT ?

this is define Data Alignment : _http://www.songho.ca/misc/alignment/dataalign.html

and SOurce code on QT Error:

_http://mfi.re/?mcwmgd0kjzeugrg

wysota
14th July 2010, 10:51
Qt is C++, it doesn't enforce any data alignment. Everything that applies to C++ applies to Qt as well.

Thành Viên Mới
14th July 2010, 11:38
Qt is C++, it doesn't enforce any data alignment. Everything that applies to C++ applies to Qt as well.

but when i run program error if use ALIGN(16)

Zlatomir
14th July 2010, 11:54
With g++ you need to use it like this:

__attribute__((aligned(16)))

Thành Viên Mới
15th July 2010, 05:17
With g++ you need to use it like this:

__attribute__((aligned(16)))

thank #define ALIGN(n) __attribute__ ((aligned(n)))

Markus_AC
25th October 2011, 10:33
Is it possible to do an alignment on the entire project?
I'm using Qt with the VS2008 DevEnv, and there is the possibility to choose a general struct alignment of the project.
But I want to do this with my Makefile and qmake.