Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: gcc/gmp/mpq/md_2exp.c

Issue 3050029: [gcc] GCC 4.5.0=>4.5.1 (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/nacl-toolchain.git
Patch Set: Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gcc/gmp/mpq/inv.c ('k') | gcc/gmp/mpq/neg.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gcc/gmp/mpq/md_2exp.c
diff --git a/gcc/gmp/mpq/md_2exp.c b/gcc/gmp/mpq/md_2exp.c
deleted file mode 100644
index 87eba75ac4de3d6a485315f88addec4e90ae5983..0000000000000000000000000000000000000000
--- a/gcc/gmp/mpq/md_2exp.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/* mpq_mul_2exp, mpq_div_2exp - multiply or divide by 2^N */
-
-/*
-Copyright 2000, 2002 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP Library is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-The GNU MP Library is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "longlong.h"
-
-
-/* The multiplier/divisor "n", representing 2^n, is applied by right shifting
- "r" until it's odd (if it isn't already), and left shifting "l" for the
- rest. */
-
-static void
-mord_2exp (mpz_ptr ldst, mpz_ptr rdst, mpz_srcptr lsrc, mpz_srcptr rsrc,
- unsigned long n)
-{
- mp_size_t rsrc_size = SIZ(rsrc);
- mp_size_t len = ABS (rsrc_size);
- mp_ptr rsrc_ptr = PTR(rsrc);
- mp_ptr p, rdst_ptr;
- mp_limb_t plow;
-
- p = rsrc_ptr;
- plow = *p;
- while (n >= GMP_NUMB_BITS && plow == 0)
- {
- n -= GMP_NUMB_BITS;
- p++;
- plow = *p;
- }
-
- /* no realloc here if rsrc==rdst, so p and rsrc_ptr remain valid */
- len -= (p - rsrc_ptr);
- MPZ_REALLOC (rdst, len);
- rdst_ptr = PTR(rdst);
-
- if ((plow & 1) || n == 0)
- {
- /* need DECR when src==dst */
- if (p != rdst_ptr)
- MPN_COPY_DECR (rdst_ptr, p, len);
- }
- else
- {
- unsigned long shift;
- if (plow == 0)
- shift = n;
- else
- {
- count_trailing_zeros (shift, plow);
- shift = MIN (shift, n);
- }
- mpn_rshift (rdst_ptr, p, len, shift);
- len -= (rdst_ptr[len-1] == 0);
- n -= shift;
- }
- SIZ(rdst) = (rsrc_size >= 0) ? len : -len;
-
- if (n)
- mpz_mul_2exp (ldst, lsrc, n);
- else if (ldst != lsrc)
- mpz_set (ldst, lsrc);
-}
-
-
-void
-mpq_mul_2exp (mpq_ptr dst, mpq_srcptr src, unsigned long n)
-{
- mord_2exp (mpq_numref (dst), mpq_denref (dst),
- mpq_numref (src), mpq_denref (src), n);
-}
-
-void
-mpq_div_2exp (mpq_ptr dst, mpq_srcptr src, unsigned long n)
-{
- if (SIZ (mpq_numref(src)) == 0)
- {
- dst->_mp_num._mp_size = 0;
- dst->_mp_den._mp_size = 1;
- dst->_mp_den._mp_d[0] = 1;
- return;
- }
-
- mord_2exp (mpq_denref (dst), mpq_numref (dst),
- mpq_denref (src), mpq_numref (src), n);
-}
« no previous file with comments | « gcc/gmp/mpq/inv.c ('k') | gcc/gmp/mpq/neg.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698