digitalmars.D - align number
- Katayama Hirofumi MZ (7/7) Jun 07 2012 version(Win64) {
- Bernard Helyer (3/10) Jun 07 2012 align(size_t.sizeof); ?
- Bernard Helyer (2/14) Jun 07 2012 Well that doesn't seem to work.
- Andrej Mitrovic (7/8) Jun 07 2012 Try this:
- Denis Shelomovskij (21/29) Jun 07 2012 This will not work as you expect. Just like
- Katayama Hirofumi MZ (2/13) Jun 07 2012 The code overlaps and it is not much smart.
- Kagamin (7/7) Jun 08 2012 template Aligned(alias Content)
- Dmitry Olshansky (4/11) Jun 08 2012 Ain't structs aligned on word boundary by default?
- Katayama Hirofumi MZ (8/8) Jun 27 2012 version(Win64) {
- Katayama Hirofumi MZ (9/9) Aug 03 2012 private template Aligned() {
version(Win64) {
const int align_number = 8;
} else {
const int align_number = 4;
}
align(align_number):
...long code...
Jun 07 2012
On Friday, 8 June 2012 at 01:46:15 UTC, Katayama Hirofumi MZ
wrote:
version(Win64) {
const int align_number = 8;
} else {
const int align_number = 4;
}
align(align_number):
...long code...
align(size_t.sizeof); ?
Jun 07 2012
On Friday, 8 June 2012 at 02:51:57 UTC, Bernard Helyer wrote:On Friday, 8 June 2012 at 01:46:15 UTC, Katayama Hirofumi MZ wrote:Well that doesn't seem to work.version(Win64) { const int align_number = 8; } else { const int align_number = 4; } align(align_number): ...long code...align(size_t.sizeof); ?
Jun 07 2012
On 6/8/12, Bernard Helyer <b.helyer gmail.com> wrote:Well that doesn't seem to work.Try this: version(Win64) { align(8): } else { align(4): }
Jun 07 2012
08.06.2012 7:31, Andrej Mitrovic написал:On 6/8/12, Bernard Helyer<b.helyer gmail.com> wrote:This will not work as you expect. Just like --- version(v1) { class } else { struct } S { int i; } --- will not compile. It's D and there is no C preprocessor: --- version(Win64) { align(8): ... aligned 8 ... } else { align(4): ... aligned 4 ... } ... default aligned ... --- -- Денис В. Шеломовский Denis V. ShelomovskijWell that doesn't seem to work.Try this: version(Win64) { align(8): } else { align(4): }
Jun 07 2012
On Friday, 8 June 2012 at 04:16:18 UTC, Denis Shelomovskij wrote:
It's D and there is no C preprocessor:
---
version(Win64) {
align(8):
... aligned 8 ...
} else {
align(4):
... aligned 4 ...
}
... default aligned ...
---
The code overlaps and it is not much smart.
Jun 07 2012
template Aligned(alias Content)
{
static if(size_t.sizeof==4)
align(4) struct Aligned{ mixin Content; }
else
align(8) struct Aligned{ mixin Content; }
}
Jun 08 2012
On 08.06.2012 23:16, Kagamin wrote:
template Aligned(alias Content)
{
static if(size_t.sizeof==4)
align(4) struct Aligned{ mixin Content; }
else
align(8) struct Aligned{ mixin Content; }
}
Ain't structs aligned on word boundary by default?
--
Dmitry Olshansky
Jun 08 2012
version(Win64) {
private const const_align = 8;
} else {
private const const_align = 1;
}
align(const_align):
...long code...
Please support me!! Please, please!
Jun 27 2012
private template Aligned() {
...long code...
}
version(Win64) {
align(8): mixin Aligned!();
} else {
align(1): mixin Aligned!();
}
---END of THREAD---
Aug 03 2012








"Katayama Hirofumi MZ" <katayama.hirofumi.mz gmail.com>