When will you implement cent and ucent?
Iain Buclaw
ibuclaw at gdcproject.org
Sat Apr 2 10:25:43 UTC 2022
On Thursday, 31 March 2022 at 18:40:52 UTC, deadalnix wrote:
> On Thursday, 31 March 2022 at 06:31:32 UTC, Walter Bright wrote:
>> You see a similar thing when 32 bit compilation does 64 bit
>> arithmetic:
>>
>> [...]
>>
>> So, yeah, supporting 128 bit arithmetic in the codegen has
>> significant advantages. 3 multiplies and 2 adds.
>>
>> Having the compiler recognize the `mul` function as a builtin
>> would enable this code gen for 128 bits.
>
> So now that you just killed the library solution by having the
> compiler specially recognize it, can we have cent/ucent?
>
> Honestly, I don't care if DMD forward the operation to
> something in druntime, that would at least allow me to have
> good codegen on LDC/GDC.
We can do the same as complex numbers here.
enum __c__int128 : core.int128.Cent;
enum __c__uint128 : core.int128.Cent;
Later, when cent/ucent have been dropped as keywords.
alias cent = __c__int128;
alias ucent = __c__uint128;
More information about the Digitalmars-d
mailing list