www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Implementing cent/ucent...

reply "Kai Nacke" <kai redstar.de> writes:
Hi all!

I started to work on cent/ucent support in LDC (and possible in 
upstream DMD). Here is the current state:

1) The pull request 
https://github.com/ldc-developers/ldc/pull/891/files implements 
cent/ucent based on the upcoming major LDC release (branch 
merge-2.067).
It is usable but relies on GCC because it uses the __int128 data 
type. My next step is to implement a synthetic int128_t type to 
enable support on all platforms.
Up to now I tested only on Linux/x86_64.

2) I already submitted some pull request for DMD, Druntime and 
Phobos to enable cent/ucent support.

How to continue?

As soon as I got it working on all compiler environment I like to 
create an upstream pull request. (May take some time because I am 
now busy with other tasks.)
But: I am not going to extend the DMD backend! This has 2 
consequences. First, we need to decide how to integrate the code.
(Do we want to clutter the code with #if WANT_CENT as I currently 
do? Should we wait for DDMD?) Second, someone needs to work on 
the DMD backend if DMD should support cent/ucent, too.

If you like to help:
- clone & test
- Druntime/Phobos should support cent/ucent. I already 
updated/created some modules but more work is needed here
- add support to the DMD backend

Regards,
Kai
Apr 07 2015
next sibling parent reply "Vladimir Panteleev" <vladimir thecybershadow.net> writes:
On Tuesday, 7 April 2015 at 15:55:24 UTC, Kai Nacke wrote:
 I started to work on cent/ucent support in LDC (and possible in 
 upstream DMD). Here is the current state:
Hi, I appreciate all the work you're doing for LDC, but isn't ucent better implemented as a library type (e.g. as a FixNum struct for arbitrary fixed-size integers)? With the deprecation/removal of complex numbers, octal literals, and hex strings, I'm not sure if cent/ucent would pass the same inclusion requirements that those features didn't. This doesn't necessarily obsolete your work - we could remove ucent from the language specification, but still expose the backend feature in some way that FixNum could use for added efficiency. If there's already been a discussion about removing cent/ucent and I missed it, my apologies.
Apr 07 2015
parent "Kai Nacke" <kai redstar.de> writes:
On Tuesday, 7 April 2015 at 18:43:06 UTC, Vladimir Panteleev 
wrote:
 On Tuesday, 7 April 2015 at 15:55:24 UTC, Kai Nacke wrote:
 I started to work on cent/ucent support in LDC (and possible 
 in upstream DMD). Here is the current state:
Hi, I appreciate all the work you're doing for LDC, but isn't ucent better implemented as a library type (e.g. as a FixNum struct for arbitrary fixed-size integers)? With the deprecation/removal of complex numbers, octal literals, and hex strings, I'm not sure if cent/ucent would pass the same inclusion requirements that those features didn't. This doesn't necessarily obsolete your work - we could remove ucent from the language specification, but still expose the backend feature in some way that FixNum could use for added efficiency. If there's already been a discussion about removing cent/ucent and I missed it, my apologies.
Hi Vladimir, for me this was a low-hanging fruit. In many cases I only had to add the special cases for max and min values. If it is not included then it is no disaster. My motivation for the implementation is - implementation of 128bit CAS - evaluation of performance of bigintnoasm with 128bit vs. 64bit on X64 Regards, Kai
Apr 07 2015
prev sibling next sibling parent "deadalnix" <deadalnix gmail.com> writes:
Awesome !
Apr 07 2015
prev sibling next sibling parent "Daniel Murphy" <yebbliesnospam gmail.com> writes:
"Kai Nacke"  wrote in message news:kxcbizohnxdtimjwlued forum.dlang.org...

 But: I am not going to extend the DMD backend! This has 2 consequences. 
 First, we need to decide how to integrate the code.
 (Do we want to clutter the code with #if WANT_CENT as I currently do? 
 Should we wait for DDMD?) Second, someone needs to work on the DMD backend 
 if DMD should support cent/ucent, too.
I'm happy to do the DMD backend, at least on x86_64. I don't want WANT_CENT anywhere in there, it would be better to enable it through a runtime flag in Target in a similar way to the simd types.
Apr 07 2015
prev sibling parent reply "Dominikus Dittes Scherkl" writes:
On Tuesday, 7 April 2015 at 15:55:24 UTC, Kai Nacke wrote:
 Hi all!

 I started to work on cent/ucent support in LDC (and possible in 
 upstream DMD). Here is the current state:
Hurray! I missed that.
 If you like to help:
 - clone & test
 - Druntime/Phobos should support cent/ucent. I already 
 updated/created some modules but more work is needed here
 - add support to the DMD backend
I once had added cent/ucent to std/traits.d
Apr 13 2015
parent reply "Kai Nacke" <kai redstar.de> writes:
On Monday, 13 April 2015 at 09:00:30 UTC, Dominikus Dittes 
Scherkl wrote:
 I once had added cent/ucent to std/traits.d
TypeInfo for cent/ucent is now in druntime. std.traits has cent/ucent support. I need to address some comments in std.format before it can be merged. Other modules (e.g. std.conv) still miss support. Regards, Kai
Apr 13 2015
parent reply "Dominikus Dittes Scherkl" writes:
On Monday, 13 April 2015 at 20:06:11 UTC, Kai Nacke wrote:
 On Monday, 13 April 2015 at 09:00:30 UTC, Dominikus Dittes 
 Scherkl wrote:
 I once had added cent/ucent to std/traits.d
TypeInfo for cent/ucent is now in druntime. std.traits has cent/ucent support.
Wow, cool.
 I need to address some comments in std.format before it can be 
 merged. Other modules (e.g. std.conv) still miss support.
Hmm. By the way: are also cent/ucent literals defined? And if yes, what's the postfix for that? Was it "T"? cent.max = 170_141_183_460_469_231_731_637_303_715_884_105_727T ucent.max = 340_282_366_920_938_463_463_374_607_431_768_211_455UT
Apr 14 2015
parent "Kai Nacke" <kai redstar.de> writes:
On Tuesday, 14 April 2015 at 10:42:31 UTC, Dominikus Dittes 
Scherkl wrote:
 By the way: are also cent/ucent literals defined?
 And if yes, what's the postfix for that? Was it "T"?
There is no postfix defined. If the value of an literal does not fit in long/ulong then the type is cent/ucent. I simply followed the rules of int/long. Regards, Kai
Apr 14 2015