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:
if(((uintptr_t)vec->data() & 0x0F) == 0) {
// great, we got memory aligned data
}
else {
// try again or use backup code
}
QVector *vec = new QVector ();
if(((uintptr_t)vec->data() & 0x0F) == 0) {
// great, we got memory aligned data
}
else {
// try again or use backup code
}
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?
Bookmarks