@@ -8,7 +8,7 @@ import std.traits;
88import mir.bitop;
99import mir.utility;
1010
11- package enum half(size_t hs) = (){
11+ package enum half(uint hs) = (){
1212 import mir.bignum.fixed: UInt;
1313 UInt! hs ret; ret.signBit = true ; return ret;
1414}();
@@ -21,8 +21,8 @@ Params:
2121
2222Note: the implementation doesn't support NaN and Infinity values.
2323+/
24- struct Fp (size_t coefficientSize, Exp = sizediff_t )
25- if ((is (Exp == int ) || is(Exp == long)) && coefficientSize % (size_t .sizeof * 8) == 0 && coefficientSize >= (size_t .sizeof * 8))
24+ struct Fp (uint coefficientSize, Exp = long )
25+ if ((is (Exp == int ) || is(Exp == long)) && coefficientSize % (uint .sizeof * 8) == 0 && coefficientSize >= (uint .sizeof * 8))
2626{
2727 import mir.bignum.fixed: UInt;
2828
@@ -161,7 +161,7 @@ struct Fp(size_t coefficientSize, Exp = sizediff_t)
161161
162162 /+ +
163163 +/
164- this (size_t size)(UInt! size integer, bool normalizedInteger = false )
164+ this (uint size)(UInt! size integer, bool normalizedInteger = false )
165165 nothrow
166166 {
167167 import mir.bignum.fixed: UInt;
@@ -313,7 +313,7 @@ struct Fp(size_t coefficientSize, Exp = sizediff_t)
313313 Fp a = this ;
314314 alias b = rhs;
315315 auto exponent = a.exponent - b.exponent;
316- a.exponent = b.exponent = - coefficientSize;
316+ a.exponent = b.exponent = - Exp( coefficientSize) ;
317317 auto ret = Fp(cast (real ) a / cast (real ) b);
318318 ret.exponent += exponent;
319319 return ret;
@@ -460,7 +460,7 @@ struct Fp(size_t coefficientSize, Exp = sizediff_t)
460460}
461461
462462// /
463- Fp! (coefficientizeA + coefficientizeB) extendedMul(size_t coefficientizeA, size_t coefficientizeB)(Fp! coefficientizeA a, Fp! coefficientizeB b)
463+ Fp! (coefficientizeA + coefficientizeB) extendedMul(uint coefficientizeA, size_t coefficientizeB)(Fp! coefficientizeA a, Fp! coefficientizeB b)
464464 @safe pure nothrow @nogc
465465{
466466 import mir.bignum.fixed: extendedMul;
@@ -480,11 +480,11 @@ template fp_log2(T)
480480 if (__traits(isFloating, T))
481481{
482482 // /
483- T fp_log2 (size_t coefficientSize, Exp = sizediff_t )(Fp! (coefficientSize, Exp) x)
483+ T fp_log2 (uint coefficientSize, Exp = long )(Fp! (coefficientSize, Exp) x)
484484 {
485485 import mir.math.common: log2;
486486 auto exponent = x.exponent + coefficientSize;
487- x.exponent = - coefficientSize;
487+ x.exponent = - Exp( coefficientSize) ;
488488 return log2 (cast (T)x) + exponent;
489489 }
490490}
@@ -506,7 +506,7 @@ template fp_log(T)
506506 if (__traits(isFloating, T))
507507{
508508 // /
509- T fp_log (size_t coefficientSize, Exp = sizediff_t )(Fp! (coefficientSize, Exp) x)
509+ T fp_log (uint coefficientSize, Exp = long )(Fp! (coefficientSize, Exp) x)
510510 {
511511 import mir.math.constant: LN2 ;
512512 return T (LN2 ) * fp_log2! T(x);
0 commit comments