--- psiconv/trunk/lib/psiconv/parse_simple.c 2001/06/17 18:47:33 117 +++ psiconv/trunk/lib/psiconv/parse_simple.c 2001/06/30 13:36:39 118 @@ -26,6 +26,18 @@ #include "parse_routines.h" #include "error.h" +/* Very inefficient, but good enough for now. By implementing it ourselves, + we do not have to link with -lm */ +psiconv_float_t pow2(int n) +{ + psiconv_float_t res=1.0; + int i; + + for (i = 0; i < (n<0?-n:n); i++) + res *= 2.0; + + return n<0?1/res:res; +} psiconv_u8 psiconv_read_u8(const psiconv_buffer buf,int lev,psiconv_u32 off, int *status) { @@ -386,7 +398,7 @@ if (temp & 0x8000) result = -result; temp = (temp & 0x7ff0) >> 4; - result *= pow(2.0,((int) temp)-0x3ff); + result *= pow2(((int) temp)-0x3ff); psiconv_debug(lev+1,off,"Float value: %f",result); if (length) *length = 8; @@ -401,3 +413,4 @@ *status = res; return 0.0; } +