gcalctool r2350 - in branches/gnome-2-24: . gcalctool
- From: rancell svn gnome org
- To: svn-commits-list gnome org
- Subject: gcalctool r2350 - in branches/gnome-2-24: . gcalctool
- Date: Mon, 26 Jan 2009 12:13:34 +0000 (UTC)
Author: rancell
Date: Mon Jan 26 12:13:34 2009
New Revision: 2350
URL: http://svn.gnome.org/viewvc/gcalctool?rev=2350&view=rev
Log:
Fix incorrect shift calculation (Bug #569176)
Modified:
branches/gnome-2-24/ChangeLog
branches/gnome-2-24/gcalctool/mpmath.c
Modified: branches/gnome-2-24/gcalctool/mpmath.c
==============================================================================
--- branches/gnome-2-24/gcalctool/mpmath.c (original)
+++ branches/gnome-2-24/gcalctool/mpmath.c Mon Jan 26 12:13:34 2009
@@ -690,11 +690,18 @@
void
calc_shift(int s[MP_SIZE], int t[MP_SIZE], int times)
{
- if (times >= 0)
- mpmuli(s, times*2, t);
+ int i, multiplier = 1;
+
+ if (times >= 0) {
+ for (i = 0; i < times; i++)
+ multiplier *= 2;
+ mpmuli(s, multiplier, t);
+ }
else {
int temp[MP_SIZE];
- mpdivi(s, -times*2, temp);
+ for (i = 0; i < -times; i++)
+ multiplier *= 2;
+ mpdivi(s, multiplier, temp);
mpcmim(temp, t);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]