Thread overview | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
June 08, 2012 align number | ||||
---|---|---|---|---|
| ||||
version(Win64) { const int align_number = 8; } else { const int align_number = 4; } align(align_number): ...long code... |
June 08, 2012 Re: align number | ||||
---|---|---|---|---|
| ||||
Posted in reply to Katayama Hirofumi MZ | 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); ?
|
June 08, 2012 Re: align number | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bernard Helyer | 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:
>> version(Win64) {
>> const int align_number = 8;
>> } else {
>> const int align_number = 4;
>> }
>>
>> align(align_number):
>>
>> ...long code...
>
> align(size_t.sizeof); ?
Well that doesn't seem to work.
|
June 08, 2012 Re: align number | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bernard Helyer | 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):
}
|
June 08, 2012 Re: align number | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | 08.06.2012 7:31, Andrej Mitrovic написал: > 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): > } 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. Shelomovskij |
June 08, 2012 Re: align number | ||||
---|---|---|---|---|
| ||||
Posted in reply to Denis Shelomovskij | 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.
|
June 08, 2012 Re: align number | ||||
---|---|---|---|---|
| ||||
Posted in reply to Katayama Hirofumi MZ | template Aligned(alias Content) { static if(size_t.sizeof==4) align(4) struct Aligned{ mixin Content; } else align(8) struct Aligned{ mixin Content; } } |
June 08, 2012 Re: align number | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | 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 |
June 28, 2012 Re: align number | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitry Olshansky | version(Win64) { private const const_align = 8; } else { private const const_align = 1; } align(const_align): ...long code... Please support me!! Please, please! |
August 04, 2012 Re: align number | ||||
---|---|---|---|---|
| ||||
Posted in reply to Katayama Hirofumi MZ | private template Aligned() { ...long code... } version(Win64) { align(8): mixin Aligned!(); } else { align(1): mixin Aligned!(); } ---END of THREAD--- |
Copyright © 1999-2021 by the D Language Foundation