Skip to content
  • Herbert Valerio Riedel's avatar
    Reimplement im/export primitives for integer-gmp2 · 42244668
    Herbert Valerio Riedel authored
    The import/export operations were available in `integer-gmp-0.5.1`
    already, but need to be reimplemented from scratch for the
    `integer-gmp-1.0.0` rewrite.
    
    This also adds a few more operations than were previously available for
    use w/ the `BigNat` type (which will be useful for implementing
    serialisation for the upcoming `Natural` type)
    
    Specifically, the following operations are (re)added (albeit with
    slightly different type-signatures):
    
     - `sizeInBaseBigNat`
     - `sizeInBaseInteger`
     - `sizeInBaseWord#`
    
     - `exportBigNatToAddr`
     - `exportIntegerToAddr`
     - `exportWordToAddr`
     - `exportBigNatToMutableByteArray`
     - `exportIntegerToMutableByteArray`
     - `exportWordToMutableByteArray`
    
     - `importBigNatFromAddr`
     - `importIntegerFromAddr`
     - `importBigNatFromByteArray`
     - `importIntegerFromByteArray`
    
    NOTE: The `integerGmpInternals` test-case is updated but not yet
          re-enabled as it contains tests for other primitives which aren't
          yet reimplemented.
    
    This addresses #9281
    
    Reviewed By: austin, duncan
    
    Differential Revision: https://phabricator.haskell.org/D480
    42244668