Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
3f327cc4
Commit
3f327cc4
authored
10 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
py: Allow MPZ_DIG_SIZE to be optionally configured by a port.
parent
567184e2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
py/mpz.h
+24
-9
24 additions, 9 deletions
py/mpz.h
with
24 additions
and
9 deletions
py/mpz.h
+
24
−
9
View file @
3f327cc4
...
...
@@ -39,22 +39,37 @@
// unsigned versions.
//
// MPZ_DIG_SIZE can be between 4 and 8*sizeof(mpz_dig_t), but it makes most
// sense to have it as large as possible. Below, the type is auto-detected
// depending on the machine, but it (and MPZ_DIG_SIZE) can be freely changed so
// long as the constraints mentioned above are met.
// sense to have it as large as possible. If MPZ_DIG_SIZE is not already
// defined then it is auto-detected below, depending on the machine. The types
// are then set based on the value of MPZ_DIG_SIZE (although they can be freely
// changed so long as the constraints mentioned above are met).
#if defined(__x86_64__) || defined(_WIN64)
// 64-bit machine, using 32-bit storage for digits
#ifndef MPZ_DIG_SIZE
#if defined(__x86_64__) || defined(_WIN64)
// 64-bit machine, using 32-bit storage for digits
#define MPZ_DIG_SIZE (32)
#else
// default: 32-bit machine, using 16-bit storage for digits
#define MPZ_DIG_SIZE (16)
#endif
#endif
#if MPZ_DIG_SIZE > 16
typedef
uint32_t
mpz_dig_t
;
typedef
uint64_t
mpz_dbl_dig_t
;
typedef
int64_t
mpz_dbl_dig_signed_t
;
#define MPZ_DIG_SIZE (32)
#else
// 32-bit machine, using 16-bit storage for digits
#elif MPZ_DIG_SIZE > 8
typedef
uint16_t
mpz_dig_t
;
typedef
uint32_t
mpz_dbl_dig_t
;
typedef
int32_t
mpz_dbl_dig_signed_t
;
#define MPZ_DIG_SIZE (16)
#elif MPZ_DIG_SIZE > 4
typedef
uint8_t
mpz_dig_t
;
typedef
uint16_t
mpz_dbl_dig_t
;
typedef
int16_t
mpz_dbl_dig_signed_t
;
#else
typedef
uint8_t
mpz_dig_t
;
typedef
uint8_t
mpz_dbl_dig_t
;
typedef
int8_t
mpz_dbl_dig_signed_t
;
#endif
#ifdef _WIN64
...
...
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