www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - Boys can we get cent/ucent

reply deadalnix <deadalnix gmail.com> writes:
I know that DMD doesn't support it, but it has been a pain in the 
ass to not have cent/ucent for me.

Adding support in LDC shouldn't be too difficult, as one can emit 
an i128 and let LLVM do the work. Would that be possible ?

There is a bunch of virtual hugs to be won doing so, and if you 
are in the bay area, definitively a beer or something :)
Jul 22 2016
next sibling parent reply David Nadlinger via digitalmars-d-ldc <digitalmars-d-ldc puremagic.com> writes:
On 22 Jul 2016, at 23:37, deadalnix via digitalmars-d-ldc wrote:
 I know that DMD doesn't support it, but it has been a pain in the ass 
 to not have cent/ucent for me.
Kai has worked on that before: https://github.com/ldc-developers/ldc/pull/1355 — David
Jul 22 2016
parent deadalnix <deadalnix gmail.com> writes:
On Friday, 22 July 2016 at 23:42:20 UTC, David Nadlinger wrote:
 On 22 Jul 2016, at 23:37, deadalnix via digitalmars-d-ldc wrote:
 I know that DMD doesn't support it, but it has been a pain in 
 the ass to not have cent/ucent for me.
Kai has worked on that before: https://github.com/ldc-developers/ldc/pull/1355 — David
<3
Jul 26 2016
prev sibling next sibling parent reply Jonathan Marler <johnnymarler gmail.com> writes:
On Friday, 22 July 2016 at 22:37:46 UTC, deadalnix wrote:
 I know that DMD doesn't support it, but it has been a pain in 
 the ass to not have cent/ucent for me.

 Adding support in LDC shouldn't be too difficult, as one can 
 emit an i128 and let LLVM do the work. Would that be possible ?

 There is a bunch of virtual hugs to be won doing so, and if you 
 are in the bay area, definitively a beer or something :)
Out of curiosity, what sort of things do you do that would use cent/ucent?
Jul 24 2016
next sibling parent deadalnix <deadalnix gmail.com> writes:
On Sunday, 24 July 2016 at 07:04:01 UTC, Jonathan Marler wrote:
 On Friday, 22 July 2016 at 22:37:46 UTC, deadalnix wrote:
 I know that DMD doesn't support it, but it has been a pain in 
 the ass to not have cent/ucent for me.

 Adding support in LDC shouldn't be too difficult, as one can 
 emit an i128 and let LLVM do the work. Would that be possible ?

 There is a bunch of virtual hugs to be won doing so, and if 
 you are in the bay area, definitively a beer or something :)
Out of curiosity, what sort of things do you do that would use cent/ucent?
Mostly for 64 bits operation that can overflow. Like when you want the mulhi of 2 longs for instance.
Jul 26 2016
prev sibling parent lkfsdg <lkfsdg sdfeazq.od> writes:
On Sunday, 24 July 2016 at 07:04:01 UTC, Jonathan Marler wrote:
 On Friday, 22 July 2016 at 22:37:46 UTC, deadalnix wrote:
 I know that DMD doesn't support it, but it has been a pain in 
 the ass to not have cent/ucent for me.

 Adding support in LDC shouldn't be too difficult, as one can 
 emit an i128 and let LLVM do the work. Would that be possible ?

 There is a bunch of virtual hugs to be won doing so, and if 
 you are in the bay area, definitively a beer or something :)
Out of curiosity, what sort of things do you do that would use cent/ucent?
bit sets up to 128 elements, on the stack and without the indirection that a BitArray would imply.
Jul 27 2016
prev sibling next sibling parent reply Johan Engelen <j j.nl> writes:
On Friday, 22 July 2016 at 22:37:46 UTC, deadalnix wrote:
 I know that DMD doesn't support it, but it has been a pain in 
 the ass to not have cent/ucent for me.

 Adding support in LDC shouldn't be too difficult, as one can 
 emit an i128 and let LLVM do the work. Would that be possible ?
How does this avoid the "fork the language" department? I ask because I have a similar issue with vector operations (https://github.com/ldc-developers/ldc/pull/1485).
Jul 26 2016
parent deadalnix <deadalnix gmail.com> writes:
On Tuesday, 26 July 2016 at 22:38:50 UTC, Johan Engelen wrote:
 On Friday, 22 July 2016 at 22:37:46 UTC, deadalnix wrote:
 I know that DMD doesn't support it, but it has been a pain in 
 the ass to not have cent/ucent for me.

 Adding support in LDC shouldn't be too difficult, as one can 
 emit an i128 and let LLVM do the work. Would that be possible ?
How does this avoid the "fork the language" department? I ask because I have a similar issue with vector operations (https://github.com/ldc-developers/ldc/pull/1485).
I say it is for the better. This isn't forking the language, cent/ucent have been in the spec like forever. Having some competition is good. And TBH, I think this is also fine for the vector thing. We can't wait for DMD to reinvent the wheel for every backend feature.
Jul 26 2016
prev sibling parent reply Kai Nacke <kai redstar.de> writes:
On Friday, 22 July 2016 at 22:37:46 UTC, deadalnix wrote:
 I know that DMD doesn't support it, but it has been a pain in 
 the ass to not have cent/ucent for me.

 Adding support in LDC shouldn't be too difficult, as one can 
 emit an i128 and let LLVM do the work. Would that be possible ?

 There is a bunch of virtual hugs to be won doing so, and if you 
 are in the bay area, definitively a beer or something :)
Hi deadalnix, the PR against ltsmaster (ldc 0.17.x) is already usable: https://github.com/ldc-developers/ldc/pull/1355 If you can life with the restrictions then I like to get some feedback on it. I already created a PR for master https://github.com/ldc-developers/ldc/pull/1659 but this one requires much more work. Regards, Kai
Jul 31 2016
parent deadalnix <deadalnix gmail.com> writes:
On Monday, 1 August 2016 at 04:59:03 UTC, Kai Nacke wrote:
 Hi deadalnix,

 the PR against ltsmaster (ldc 0.17.x) is already usable:

 https://github.com/ldc-developers/ldc/pull/1355

 If you can life with the restrictions then I like to get some 
 feedback on it.

 I already created a PR for master

 https://github.com/ldc-developers/ldc/pull/1659

 but this one requires much more work.

 Regards,
 Kai
I'm sorry I missed your message. I'd be happy with that. If the codegen works, that's good enough for me.
Sep 07 2016