Skip to content
This repository has been archived by the owner on Jun 20, 2019. It is now read-only.

Implement core.checkedint as frontend intrinsics #110

Merged
merged 1 commit into from
Jun 30, 2015

Conversation

ibuclaw
Copy link
Member

@ibuclaw ibuclaw commented Jun 29, 2015

As per the comments in core.checkedint (introduced in 2.066 IIRC).

While the generic versions of these functions are computationally expensive relative to the cost of the operation itself, compiler implementations are free to recognize them and generate equivalent and faster code.

This PR implements our compiler implementation, leveraging integer overflow built-ins.

@ibuclaw ibuclaw mentioned this pull request Jun 29, 2015
@ibuclaw
Copy link
Member Author

ibuclaw commented Jun 30, 2015

Needs changelog, and also to support negs, which I think using subs(0, x) should do the trick.

@ibuclaw
Copy link
Member Author

ibuclaw commented Jun 30, 2015

@jpf91 - Feel free to merge in your own time. ;-)

@jpf91
Copy link
Contributor

jpf91 commented Jun 30, 2015

LGTM

jpf91 added a commit that referenced this pull request Jun 30, 2015
Implement core.checkedint as frontend intrinsics
@jpf91 jpf91 merged commit 12ad5d9 into D-Programming-GDC:master Jun 30, 2015
@ibuclaw ibuclaw deleted the checkedint branch June 30, 2015 18:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants