Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tamar Christina
GHC
Commits
680c1a9e
Commit
680c1a9e
authored
13 years ago
by
Ian Lynagh
Browse files
Options
Downloads
Patches
Plain Diff
Define mkInteger
Now used by GHC to generate Integer literals.
parent
9935359f
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libraries/integer-gmp/GHC/Integer.lhs
+1
-1
1 addition, 1 deletion
libraries/integer-gmp/GHC/Integer.lhs
libraries/integer-gmp/GHC/Integer/Type.lhs
+10
-0
10 additions, 0 deletions
libraries/integer-gmp/GHC/Integer/Type.lhs
with
11 additions
and
1 deletion
libraries/integer-gmp/GHC/Integer.lhs
+
1
−
1
View file @
680c1a9e
...
...
@@ -18,7 +18,7 @@
#include "MachDeps.h"
module GHC.Integer (
Integer,
Integer,
mkInteger,
smallInteger, wordToInteger, integerToWord, integerToInt,
#if WORD_SIZE_IN_BITS < 64
integerToWord64, word64ToInteger,
...
...
This diff is collapsed.
Click to expand it.
libraries/integer-gmp/GHC/Integer/Type.lhs
+
10
−
0
View file @
680c1a9e
...
...
@@ -72,6 +72,16 @@ data Integer
= S# Int# -- small integers
| J# Int# ByteArray# -- large integers
mkInteger :: Bool -- non-negative?
-> [Int] -- absolute value in 31 bit chunks, least significant first
-- ideally these would be Words rather than Ints, but
-- we don't have Word available at the moment.
-> Integer
mkInteger nonNegative is = let abs = f is
in if nonNegative then abs else negateInteger abs
where f [] = S# 0#
f (I# i : is') = S# i `orInteger` shiftLInteger (f is') 31#
{-# NOINLINE smallInteger #-}
smallInteger :: Int# -> Integer
smallInteger i = S# i
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment