Hello there. I'm using some SSE optimizations on a large QVector and I need the QVector().data() pointer to be 16-byte memory aligned. My code goes something like this:

Qt Code:
  1. QVector *vec = new QVector ();
  2.  
  3. if(((uintptr_t)vec->data() & 0x0F) == 0) {
  4. // great, we got memory aligned data
  5. }
  6. else {
  7. // try again or use backup code
  8. }
To copy to clipboard, switch view to plain text mode 

My code works but whether I can use optimizations is completely random and so far I couldn't find a way to make QVector acquire a memory aligned data pointer. Any ideas?