Can we have ucent ?

Johan Engelen j at j.nl
Sat Nov 3 12:58:26 UTC 2018


On Tuesday, 30 October 2018 at 18:07:23 UTC, Basile B. wrote:
> For the first time today i had needed the ucent type. 
> Fortunately it was only for bit operations so easy to do as a 
> struct, however this is two hours lost for a type that's in a 
> curious state (rename it shrodinger128 maybe ?).
>
> I think that the feature could be implemented as compiler 
> special functions that would be located in druntime (with 
> special case for GDC and LDC since the type exists in their 
> respective backend if i understand correctly).

LDC has had a PR open for adding `ucent` since a long time [*]. 
The biggest implementation hurdle seems to be that we (LDC) don't 
have our own frontend.

In my opinion this effort should be split into two parts:
1 - Add `ucent` support to the frontend (semantic analysis, CTFE)
       Simply emit an error in the backend when `ucent` codegen is 
requested,
       saying that "ucent is not yet supported for the current 
target".
       `wideint` library could be used to do 128-bit math at 
compile-time.
2 - Add `ucent` support to DMD, LDC, GDC backends. (easy for LDC 
and GDC)

- Johan


[*] https://github.com/ldc-developers/ldc/pull/1355


More information about the Digitalmars-d mailing list