Mercurial > projects > qtd
comparison qt/QGlobal.d.inc @ 186:d5af7c48b733
fix for 64but
author | eldar |
---|---|
date | Sat, 04 Jul 2009 13:41:21 +0000 |
parents | 7d9db724ee1d |
children | 7dd099050621 |
comparison
equal
deleted
inserted
replaced
185:4fcf7ba2a791 | 186:d5af7c48b733 |
---|---|
592 } | 592 } |
593 | 593 |
594 private | 594 private |
595 const PTR_ALIGN = Align.tupleof[1].alignof; | 595 const PTR_ALIGN = Align.tupleof[1].alignof; |
596 | 596 |
597 version( X86 ) | |
598 const MEM_ALIGN = 8u; | |
599 else | |
600 static assert(false, "Unknown memory alignment for this platform."); | |
601 | |
602 private | 597 private |
603 template AlignPad(size_t base, size_t aligned) | 598 template AlignPad(size_t base, size_t aligned) |
604 { | 599 { |
605 static if( aligned == 0 ) | 600 static if( aligned == 0 ) |
606 const AlignPad = base; | 601 const AlignPad = base; |
665 const Max = a; | 660 const Max = a; |
666 else | 661 else |
667 const Max = b; | 662 const Max = b; |
668 } | 663 } |
669 | 664 |
670 template InstanceSizeAligned(T, size_t alignment=MEM_ALIGN) | |
671 { | |
672 static if( alignment == 0 ) | |
673 const InstanceSizeAligned = InstanceSize!(T); | |
674 else | |
675 const uint InstanceSizeAligned | |
676 = InstanceSizeAlignImpl!(T, alignment).result; | |
677 } | |
678 | |
679 private | |
680 template InstanceSizeAlignedImpl(T, size_t alignment) | |
681 { | |
682 private const base_size = InstanceSize!(T); | |
683 const result = ((base_size+alignment-1)/alignment)*alignment; | |
684 } | |
685 | |
686 private | 665 private |
687 template InterfaceCount(T) | 666 template InterfaceCount(T) |
688 { | 667 { |
689 static if( is( T == Object ) ) | 668 static if( is( T == Object ) ) |
690 const InterfaceCount = 0u; | 669 const InterfaceCount = 0u; |