summaryrefslogtreecommitdiffstats
path: root/src/3rdparty
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-01-23 12:23:40 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-08-19 09:14:18 (GMT)
commitdac482f71679f2175c9379e442d69e3993ec7730 (patch)
tree212195e4ec1965267dc7833d2eae2225539876eb /src/3rdparty
parent1e48bc0dd534ad96ec1fbf650b74133c16d1e0fb (diff)
downloadQt-dac482f71679f2175c9379e442d69e3993ec7730.zip
Qt-dac482f71679f2175c9379e442d69e3993ec7730.tar.gz
Qt-dac482f71679f2175c9379e442d69e3993ec7730.tar.bz2
Add support for aligned buffers without alignment macros
If we don't have alignment macros, we do what we can: overcommit 64 bytes and find the proper 64-byte-aligned position in the buffer.
Diffstat (limited to 'src/3rdparty')
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h
index 7cba4e4..bff770c 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h
@@ -45,7 +45,7 @@ namespace WTF {
#define WTF_ALIGN_OF(type) __alignof(type)
#define WTF_ALIGNED(variable_type, variable, n) __declspec(align(n)) variable_type variable
#else
- #error WTF_ALIGN macros need alignment control.
+ #define WTF_ALIGN_OF(type) 0
#endif
#if COMPILER(GCC) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 303)
@@ -54,6 +54,7 @@ namespace WTF {
typedef char AlignedBufferChar;
#endif
+ #ifdef WTF_ALIGNED
template <size_t size, size_t alignment> struct AlignedBuffer;
template <size_t size> struct AlignedBuffer<size, 1> { AlignedBufferChar buffer[size]; };
template <size_t size> struct AlignedBuffer<size, 2> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 2); };
@@ -62,6 +63,17 @@ namespace WTF {
template <size_t size> struct AlignedBuffer<size, 16> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 16); };
template <size_t size> struct AlignedBuffer<size, 32> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 32); };
template <size_t size> struct AlignedBuffer<size, 64> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 64); };
+ #else
+ template <size_t size, size_t> struct AlignedBuffer
+ {
+ AlignedBufferChar oversizebuffer[size + 64];
+ AlignedBufferChar *buffer;
+ inline AlignedBuffer() : buffer(oversizebuffer)
+ {
+ buffer += 64 - (reinterpret_cast<size_t>(buffer) & 0x3f);
+ }
+ };
+ #endif
template <bool needsDestruction, typename T>
class VectorDestructor;