decNumber.c (decNumberPower): Constify.
* decNumber.c (decNumberPower): Constify. * decNumber.h (decNumberPower): Likewise. From-SVN: r116990
This commit is contained in:
parent
a22719c100
commit
e757d6b231
@ -1,3 +1,8 @@
|
|||||||
|
2006-09-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||||
|
|
||||||
|
* decNumber.c (decNumberPower): Constify.
|
||||||
|
* decNumber.h (decNumberPower): Likewise.
|
||||||
|
|
||||||
2006-09-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
2006-09-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||||
|
|
||||||
* configure.ac (ACX_PROG_CC_WARNING_OPTS): Add -Wcast-qual.
|
* configure.ac (ACX_PROG_CC_WARNING_OPTS): Add -Wcast-qual.
|
||||||
|
@ -964,13 +964,13 @@ decNumberNormalize (decNumber * res, const decNumber * rhs, decContext * set)
|
|||||||
/* Specification restriction: abs(n) must be <=999999999 */
|
/* Specification restriction: abs(n) must be <=999999999 */
|
||||||
/* ------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------ */
|
||||||
decNumber *
|
decNumber *
|
||||||
decNumberPower (decNumber * res, decNumber * lhs,
|
decNumberPower (decNumber * res, const decNumber * lhs,
|
||||||
decNumber * rhs, decContext * set)
|
const decNumber * rhs, decContext * set)
|
||||||
{
|
{
|
||||||
decNumber *alloclhs = NULL; /* non-NULL if rounded lhs allocated */
|
decNumber *alloclhs = NULL; /* non-NULL if rounded lhs allocated */
|
||||||
decNumber *allocrhs = NULL; /* .., rhs */
|
decNumber *allocrhs = NULL; /* .., rhs */
|
||||||
decNumber *allocdac = NULL; /* -> allocated acc buffer, iff used */
|
decNumber *allocdac = NULL; /* -> allocated acc buffer, iff used */
|
||||||
decNumber *inrhs = rhs; /* save original rhs */
|
const decNumber *inrhs = rhs; /* save original rhs */
|
||||||
Int reqdigits = set->digits; /* requested DIGITS */
|
Int reqdigits = set->digits; /* requested DIGITS */
|
||||||
Int n; /* RHS in binary */
|
Int n; /* RHS in binary */
|
||||||
Int i; /* work */
|
Int i; /* work */
|
||||||
@ -1117,6 +1117,7 @@ decNumberPower (decNumber * res, decNumber * lhs,
|
|||||||
/* we'll invert the lhs now rather than inverting the result later */
|
/* we'll invert the lhs now rather than inverting the result later */
|
||||||
if (decNumberIsNegative (rhs))
|
if (decNumberIsNegative (rhs))
|
||||||
{ /* was a **-n [hence digits>0] */
|
{ /* was a **-n [hence digits>0] */
|
||||||
|
decNumber * newlhs;
|
||||||
decNumberCopy (&dnOne, dac); /* dnOne=1; [needed now or later] */
|
decNumberCopy (&dnOne, dac); /* dnOne=1; [needed now or later] */
|
||||||
#if DECSUBSET
|
#if DECSUBSET
|
||||||
if (set->extended)
|
if (set->extended)
|
||||||
@ -1138,13 +1139,14 @@ decNumberPower (decNumber * res, decNumber * lhs,
|
|||||||
status |= DEC_Insufficient_storage;
|
status |= DEC_Insufficient_storage;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
lhs = alloclhs; /* use the allocated space */
|
newlhs = alloclhs; /* use the allocated space */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
lhs = (decNumber *) lhsbuff; /* use stack storage */
|
newlhs = (decNumber *) lhsbuff; /* use stack storage */
|
||||||
/* [lhs now points to buffer or allocated storage] */
|
/* [lhs now points to buffer or allocated storage] */
|
||||||
decNumberCopy (lhs, dac); /* copy the 1/lhs */
|
decNumberCopy (newlhs, dac); /* copy the 1/lhs */
|
||||||
decNumberCopy (dac, &dnOne); /* restore acc=1 */
|
decNumberCopy (dac, &dnOne); /* restore acc=1 */
|
||||||
|
lhs = newlhs;
|
||||||
#if DECSUBSET
|
#if DECSUBSET
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -152,8 +152,8 @@ decNumber *decNumberMultiply (decNumber *, const decNumber *,
|
|||||||
const decNumber *, decContext *);
|
const decNumber *, decContext *);
|
||||||
decNumber *decNumberNormalize (decNumber *, const decNumber *, decContext *);
|
decNumber *decNumberNormalize (decNumber *, const decNumber *, decContext *);
|
||||||
decNumber *decNumberPlus (decNumber *, const decNumber *, decContext *);
|
decNumber *decNumberPlus (decNumber *, const decNumber *, decContext *);
|
||||||
decNumber *decNumberPower (decNumber *, decNumber *, decNumber *,
|
decNumber *decNumberPower (decNumber *, const decNumber *,
|
||||||
decContext *);
|
const decNumber *, decContext *);
|
||||||
decNumber *decNumberQuantize (decNumber *, const decNumber *,
|
decNumber *decNumberQuantize (decNumber *, const decNumber *,
|
||||||
const decNumber *, decContext *);
|
const decNumber *, decContext *);
|
||||||
decNumber *decNumberRemainder (decNumber *, const decNumber *,
|
decNumber *decNumberRemainder (decNumber *, const decNumber *,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user