Compile time macro trouble.

Kai Nacke via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Sun Mar 13 06:47:39 PDT 2016


On Sunday, 13 March 2016 at 12:52:01 UTC, Lass Safin wrote:
> On Sunday, 13 March 2016 at 06:15:34 UTC, Taylor Hillegeist 
> wrote:
>>
>> So here: https://dlang.org/pretod.html
>> there is a lovely section about how doing normal functions is 
>> basically a processor macro.
>>
>> The C Preprocessor Way:
>> #define X(i)	((i) = (i) / 3)
>>
>> The D Way:
>> int X(ref int i) { return i = i / 3; }
>>
>> However I am running into troubles with the truthfulness of 
>> this on LDC for thumb cortex-m0plus.
>>
>> MKL25Z.d
>> line 5243:
>> uint32_t SIM_SOPT2_TPMSRC(uint32_t x)  {return ((x << 
>> SIM_SOPT2_TPMSRC_SHIFT) & SIM_SOPT2_TPMSRC_MASK);}
>> [...]
>> Is this an error on ldc's part or do i need to do something 
>> more to get the correct result?
>
> Try using DMD, it may just be a bug in LDC.

Didn't know that DMD has a thumb cortex-m0plus backend ;-)


More information about the digitalmars-d-ldc mailing list