gcalctool r2349 - in trunk: . gcalctool
- From: rancell svn gnome org
- To: svn-commits-list gnome org
- Subject: gcalctool r2349 - in trunk: . gcalctool
- Date: Mon, 26 Jan 2009 12:03:46 +0000 (UTC)
Author: rancell
Date: Mon Jan 26 12:03:46 2009
New Revision: 2349
URL: http://svn.gnome.org/viewvc/gcalctool?rev=2349&view=rev
Log:
Fix incorrect shift calculation (Bug #569176)
Modified:
trunk/ChangeLog
trunk/gcalctool/mp-binary.c
Modified: trunk/gcalctool/mp-binary.c
==============================================================================
--- trunk/gcalctool/mp-binary.c (original)
+++ trunk/gcalctool/mp-binary.c Mon Jan 26 12:03:46 2009
@@ -125,11 +125,18 @@
void
mp_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]