move pow_decn from header to source file

This commit is contained in:
Mirko Scholz 2020-09-05 00:18:47 +02:00
parent 1fb0a1fd50
commit 5ea2818fe3
2 changed files with 13 additions and 21 deletions

View File

@ -74,7 +74,7 @@ __xdata dec80 Tmp4Decn; //used by div_decn() and pow_decn()
__xdata char Buf[DECN_BUF_SIZE];
void copy_decn(dec80* dest, const dec80* src){
void copy_decn(dec80* const dest, const dec80* const src){
uint8_t i;
dest->exponent = src->exponent;
@ -84,7 +84,7 @@ void copy_decn(dec80* dest, const dec80* src){
}
}
exp_t get_exponent(const dec80* x){
exp_t get_exponent(const dec80* const x){
exp_t exponent = x->exponent;
#ifdef EXP16
if (exponent & 0x4000){ //negative
@ -1218,14 +1218,14 @@ inline void exp10_decn(void){
exp_decn();
}
//inline void pow_decn(void)
//{
// copy_decn(&Tmp4Decn, &BDecn); //save b
// ln_decn();
// copy_decn(&BDecn, &Tmp4Decn); //restore b
// mult_decn(); //accum = b*ln(accum)
// exp_decn();
//}
inline void pow_decn(void) {
//calculate AccDecn = AccDecn ^ BDecn
copy_decn(&Tmp4Decn, &BDecn); //save b
ln_decn();
copy_decn(&BDecn, &Tmp4Decn); //restore b
mult_decn(); //accum = b*ln(accum)
exp_decn();
}
static void set_str_error(void){

View File

@ -68,9 +68,9 @@ static const dec80 DECN_LN_10 = {
};
//remove sign bit, and return 15 bit exponent sign-extended to 16 bits
exp_t get_exponent(const dec80* x);
exp_t get_exponent(const dec80* const x);
void copy_decn(dec80* dest, const dec80* src);
void copy_decn(dec80* const dest, const dec80* const src);
extern dec80 AccDecn;
extern __idata dec80 BDecn;
@ -94,15 +94,7 @@ void log10_decn(void);
void exp_decn(void);
void exp10_decn(void);
//calculate AccDecn = AccDecn ^ BDecn
#define pow_decn() do {\
copy_decn(&Tmp4Decn, &BDecn); \
ln_decn(); \
copy_decn(&BDecn, &Tmp4Decn); \
mult_decn(); \
exp_decn(); \
} while (0);
void pow_decn(void);
//Buf should hold at least 18 + 4 + 5 + 1 = 28
#define DECN_BUF_SIZE 28