Skip to content

bpo-40874: Update to libmpdec-2.5.0 (GH-20652) #20652

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

Merged
merged 2 commits into from
Jun 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions Modules/_decimal/libmpdec/basearith.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
* Copyright (c) 2008-2020 Stefan Krah. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -27,13 +27,13 @@


#include "mpdecimal.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <assert.h>
#include <stdio.h>

#include "basearith.h"
#include "constants.h"
#include "typearith.h"
#include "basearith.h"


/*********************************************************************/
Expand Down Expand Up @@ -337,6 +337,7 @@ _mpd_basedivmod(mpd_uint_t *q, mpd_uint_t *r,

/* D2: loop */
for (j=m; j != MPD_SIZE_MAX; j--) {
assert(2 <= j+n && j+n <= nplusm); /* annotation for scan-build */

/* D3: calculate qhat and rhat */
rhat = _mpd_shortdiv(w2, u+j+n-1, 2, v[n-1]);
Expand Down Expand Up @@ -652,6 +653,3 @@ _mpd_shortdiv_b(mpd_uint_t *w, const mpd_uint_t *u, mpd_size_t n,

return rem;
}



12 changes: 4 additions & 8 deletions Modules/_decimal/libmpdec/basearith.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
* Copyright (c) 2008-2020 Stefan Krah. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand All @@ -26,12 +26,11 @@
*/


#ifndef BASEARITH_H
#define BASEARITH_H
#ifndef LIBMPDEC_BASEARITH_H_
#define LIBMPDEC_BASEARITH_H_


#include "mpdecimal.h"
#include <stdio.h>
#include "typearith.h"


Expand Down Expand Up @@ -216,7 +215,4 @@ _mpd_isallnine(const mpd_uint_t *data, mpd_ssize_t len)
MPD_PRAGMA(MPD_HIDE_SYMBOLS_END) /* restore previous scope rules */


#endif /* BASEARITH_H */



#endif /* LIBMPDEC_BASEARITH_H_ */
12 changes: 4 additions & 8 deletions Modules/_decimal/libmpdec/bits.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
* Copyright (c) 2008-2020 Stefan Krah. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand All @@ -26,12 +26,11 @@
*/


#ifndef BITS_H
#define BITS_H
#ifndef LIBMPDEC_BITS_H_
#define LIBMPDEC_BITS_H_


#include "mpdecimal.h"
#include <stdio.h>


/* Check if n is a power of 2. */
Expand Down Expand Up @@ -186,7 +185,4 @@ mpd_bsf(mpd_size_t a)
#endif /* BSR/BSF */


#endif /* BITS_H */



#endif /* LIBMPDEC_BITS_H_ */
5 changes: 1 addition & 4 deletions Modules/_decimal/libmpdec/constants.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
* Copyright (c) 2008-2020 Stefan Krah. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -27,7 +27,6 @@


#include "mpdecimal.h"
#include <stdio.h>
#include "constants.h"


Expand Down Expand Up @@ -128,5 +127,3 @@ const char *mpd_clamp_string[MPD_CLAMP_GUARD] = {
"CLAMP_DEFAULT",
"CLAMP_IEEE_754"
};


13 changes: 6 additions & 7 deletions Modules/_decimal/libmpdec/constants.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
* Copyright (c) 2008-2020 Stefan Krah. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand All @@ -26,12 +26,14 @@
*/


#ifndef CONSTANTS_H
#define CONSTANTS_H
#ifndef LIBMPDEC_CONSTANTS_H_
#define LIBMPDEC_CONSTANTS_H_


#include "mpdecimal.h"

#include <stdint.h>


/* Internal header file: all symbols have local scope in the DSO */
MPD_PRAGMA(MPD_HIDE_SYMBOLS_START)
Expand Down Expand Up @@ -84,7 +86,4 @@ extern const mpd_uint_t UH_P1P2;
MPD_PRAGMA(MPD_HIDE_SYMBOLS_END) /* restore previous scope rules */


#endif /* CONSTANTS_H */



#endif /* LIBMPDEC_CONSTANTS_H_ */
10 changes: 5 additions & 5 deletions Modules/_decimal/libmpdec/context.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
* Copyright (c) 2008-2020 Stefan Krah. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -27,14 +27,16 @@


#include "mpdecimal.h"

#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>


void
mpd_dflt_traphandler(mpd_context_t *ctx UNUSED)
mpd_dflt_traphandler(mpd_context_t *ctx)
{
(void)ctx;
raise(SIGFPE);
}

Expand Down Expand Up @@ -282,5 +284,3 @@ mpd_addstatus_raise(mpd_context_t *ctx, uint32_t flags)
mpd_traphandler(ctx);
}
}


7 changes: 2 additions & 5 deletions Modules/_decimal/libmpdec/convolute.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
* Copyright (c) 2008-2020 Stefan Krah. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -27,15 +27,14 @@


#include "mpdecimal.h"
#include <stdio.h>
#include "bits.h"
#include "constants.h"
#include "convolute.h"
#include "fnt.h"
#include "fourstep.h"
#include "numbertheory.h"
#include "sixstep.h"
#include "umodarith.h"
#include "convolute.h"


/* Bignum: Fast convolution using the Number Theoretic Transform. Used for
Expand Down Expand Up @@ -170,5 +169,3 @@ fnt_autoconvolute(mpd_uint_t *c1, mpd_size_t n, int modnum)

return 1;
}


9 changes: 4 additions & 5 deletions Modules/_decimal/libmpdec/convolute.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
* Copyright (c) 2008-2020 Stefan Krah. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand All @@ -26,12 +26,11 @@
*/


#ifndef CONVOLUTE_H
#define CONVOLUTE_H
#ifndef LIBMPDEC_CONVOLUTE_H_
#define LIBMPDEC_CONVOLUTE_H_


#include "mpdecimal.h"
#include <stdio.h>


/* Internal header file: all symbols have local scope in the DSO */
Expand All @@ -47,4 +46,4 @@ int fnt_autoconvolute(mpd_uint_t *c1, mpd_size_t n, int modnum);
MPD_PRAGMA(MPD_HIDE_SYMBOLS_END) /* restore previous scope rules */


#endif
#endif /* LIBMPDEC_CONVOLUTE_H_ */
11 changes: 6 additions & 5 deletions Modules/_decimal/libmpdec/crt.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
* Copyright (c) 2008-2020 Stefan Krah. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -27,11 +27,14 @@


#include "mpdecimal.h"
#include <stdio.h>

#include <assert.h>

#include "constants.h"
#include "crt.h"
#include "numbertheory.h"
#include "umodarith.h"
#include "crt.h"
#include "typearith.h"


/* Bignum: Chinese Remainder Theorem, extends the maximum transform length. */
Expand Down Expand Up @@ -175,5 +178,3 @@ crt3(mpd_uint_t *x1, mpd_uint_t *x2, mpd_uint_t *x3, mpd_size_t rsize)

assert(carry[0] == 0 && carry[1] == 0 && carry[2] == 0);
}


9 changes: 4 additions & 5 deletions Modules/_decimal/libmpdec/crt.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
* Copyright (c) 2008-2020 Stefan Krah. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand All @@ -26,12 +26,11 @@
*/


#ifndef CRT_H
#define CRT_H
#ifndef LIBMPDEC_CRT_H_
#define LIBMPDEC_CRT_H_


#include "mpdecimal.h"
#include <stdio.h>


/* Internal header file: all symbols have local scope in the DSO */
Expand All @@ -44,4 +43,4 @@ void crt3(mpd_uint_t *x1, mpd_uint_t *x2, mpd_uint_t *x3, mpd_size_t nmemb);
MPD_PRAGMA(MPD_HIDE_SYMBOLS_END) /* restore previous scope rules */


#endif
#endif /* LIBMPDEC_CRT_H_ */
10 changes: 5 additions & 5 deletions Modules/_decimal/libmpdec/difradix2.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
* Copyright (c) 2008-2020 Stefan Krah. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -27,12 +27,14 @@


#include "mpdecimal.h"
#include <stdio.h>

#include <assert.h>

#include "bits.h"
#include "constants.h"
#include "difradix2.h"
#include "numbertheory.h"
#include "umodarith.h"
#include "difradix2.h"


/* Bignum: The actual transform routine (decimation in frequency). */
Expand Down Expand Up @@ -169,5 +171,3 @@ fnt_dif2(mpd_uint_t a[], mpd_size_t n, struct fnt_params *tparams)

bitreverse_permute(a, n);
}


9 changes: 4 additions & 5 deletions Modules/_decimal/libmpdec/difradix2.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
* Copyright (c) 2008-2020 Stefan Krah. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand All @@ -26,12 +26,11 @@
*/


#ifndef DIF_RADIX2_H
#define DIF_RADIX2_H
#ifndef LIBMPDEC_DIFRADIX2_H_
#define LIBMPDEC_DIFRADIX2_H_


#include "mpdecimal.h"
#include <stdio.h>
#include "numbertheory.h"


Expand All @@ -45,4 +44,4 @@ void fnt_dif2(mpd_uint_t a[], mpd_size_t n, struct fnt_params *tparams);
MPD_PRAGMA(MPD_HIDE_SYMBOLS_END) /* restore previous scope rules */


#endif
#endif /* LIBMPDEC_DIFRADIX2_H_ */
12 changes: 5 additions & 7 deletions Modules/_decimal/libmpdec/fnt.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
* Copyright (c) 2008-2020 Stefan Krah. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -27,13 +27,14 @@


#include "mpdecimal.h"
#include <stdio.h>
#include <stdlib.h>

#include <assert.h>
#include <stdio.h>

#include "bits.h"
#include "difradix2.h"
#include "numbertheory.h"
#include "fnt.h"
#include "numbertheory.h"


/* Bignum: Fast transform for medium-sized coefficients. */
Expand Down Expand Up @@ -76,6 +77,3 @@ std_inv_fnt(mpd_uint_t *a, mpd_size_t n, int modnum)
mpd_free(tparams);
return 1;
}



Loading