- 
                Notifications
    You must be signed in to change notification settings 
- Fork 212
made set_double arch/mem-layout independent #160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Closed
      
      
    
  
     Closed
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            21 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      6ded81a
              
                made set_double arch/mem-layout independent
              
              
                czurnieden afb7c63
              
                added get/set for 'float', 'long double'; additional tests for edgeca…
              
              
                czurnieden 77e135d
              
                made minad's code default with fallback to more portable but slower i…
              
              
                czurnieden 6975d57
              
                reinstalled lost backslash
              
              
                czurnieden e57ee21
              
                update license in prolog
              
              
                czurnieden a0f73b7
              
                mainly fixes
              
              
                czurnieden aa6577d
              
                renamed macro defining limited IEEE-754 compliance
              
              
                czurnieden f546d1e
              
                corrected check for IEEE-compliance
              
              
                czurnieden 6255b1c
              
                Valgrind does not support long double
              
              
                czurnieden 15444f0
              
                Initialize variable to avoid unnecessary clang warning
              
              
                czurnieden 2570a49
              
                full m68k+FPU support for get/set floats
              
              
                czurnieden 2efbd3a
              
                update tests
              
              
                czurnieden af95807
              
                run `make astyle`
              
              
                sjaeckel d608d38
              
                allow filtering of tests executed
              
              
                sjaeckel ce8548e
              
                move double/float-related stuff right over test_mp_set_double()
              
              
                sjaeckel 37b8cde
              
                improve valgrind-related stuff a bit
              
              
                sjaeckel c495a3c
              
                minor changes
              
              
                sjaeckel 67ae060
              
                add pre-commit hook
              
              
                sjaeckel 59c1375
              
                added documentation re x87 warning macro
              
              
                czurnieden 3de7a5e
              
                switched valgrind off in Travis (not installed in Travis)
              
              
                czurnieden 40b46f7
              
                added valgrind test
              
              
                czurnieden File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| #include "tommath_private.h" | ||
| #ifdef BN_MP_GET_FLOAT_C | ||
| /* LibTomMath, multiple-precision integer library -- Tom St Denis | ||
| * | ||
| * LibTomMath is a library that provides multiple-precision | ||
| * integer arithmetic as well as number theoretic functionality. | ||
| * | ||
| * The library was designed directly after the MPI library by | ||
| * Michael Fromberger but has been written from scratch with | ||
| * additional optimizations in place. | ||
| * | ||
| * SPDX-License-Identifier: Unlicense | ||
| */ | ||
| #include <float.h> | ||
| #ifdef FLT_MAX | ||
| /* This function is independent of the implementation of the floating point type */ | ||
| float mp_get_float(const mp_int *a) | ||
| { | ||
| int i; | ||
| float d = 0.0, fac = 1.0; | ||
| for (i = 0; i < DIGIT_BIT; ++i) { | ||
| fac *= 2.0; | ||
| } | ||
| for (i = a->used; i --> 0;) { | ||
| d = (d * fac) + (float)DIGIT(a, i); | ||
| } | ||
| return (a->sign == MP_NEG) ? -d : d; | ||
| } | ||
| #else | ||
| /* pragma message() not supported by several compilers (in mostly older but still used versions) */ | ||
| # ifdef _MSC_VER | ||
| # pragma message("The type 'float' does not seem to be supported on your system.") | ||
| # pragma message("If that is wrong please contact the team at https://github.com/libtom/libtommath") | ||
| # else | ||
| # warning "The type 'float' does not seem to be supported on your system." | ||
| # warning "If that is wrong please contact the team at https://github.com/libtom/libtommath" | ||
| # endif | ||
| #endif | ||
| #endif | ||
|  | ||
| /* ref: $Format:%D$ */ | ||
| /* git commit: $Format:%H$ */ | ||
| /* commit time: $Format:%ai$ */ | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| #include "tommath_private.h" | ||
| #ifdef BN_MP_GET_LONG_DOUBLE_C | ||
| /* LibTomMath, multiple-precision integer library -- Tom St Denis | ||
| * | ||
| * LibTomMath is a library that provides multiple-precision | ||
| * integer arithmetic as well as number theoretic functionality. | ||
| * | ||
| * The library was designed directly after the MPI library by | ||
| * Michael Fromberger but has been written from scratch with | ||
| * additional optimizations in place. | ||
| * | ||
| * SPDX-License-Identifier: Unlicense | ||
| */ | ||
| #include <float.h> | ||
| #ifdef LDBL_MAX | ||
| /* This function is independent of the implementation of the floating point type */ | ||
| long double mp_get_long_double(const mp_int *a) | ||
| { | ||
| int i; | ||
| long double d = 0.0, fac = 1.0; | ||
| for (i = 0; i < DIGIT_BIT; ++i) { | ||
| fac *= 2.0; | ||
| } | ||
| for (i = a->used; i --> 0;) { | ||
| d = (d * fac) + (long double)DIGIT(a, i); | ||
| } | ||
| return (a->sign == MP_NEG) ? -d : d; | ||
| } | ||
| #else | ||
| /* pragma message() not supported by several compilers (in mostly older but still used versions) */ | ||
| # ifdef _MSC_VER | ||
| # pragma message("The type 'long double' does not seem to be supported on your system.") | ||
| # pragma message("If that is wrong please contact the team at https://github.com/libtom/libtommath") | ||
| # else | ||
| # warning "The type 'long double' does not seem to be supported on your system." | ||
| # warning "If that is wrong please contact the team at https://github.com/libtom/libtommath" | ||
| # endif | ||
| #endif | ||
| #endif | ||
|  | ||
| /* ref: $Format:%D$ */ | ||
| /* git commit: $Format:%H$ */ | ||
| /* commit time: $Format:%ai$ */ | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.