void floatMult(int eSize, int mSize, int s1, int e1, int m1, int s2, int e2, int m2) { int sign = 0; /* 0 == pos, 1 == neg*/ int exp; int mant = 0; int mMask = 1 << mSize; if (s1 != s2) sign = 1; exp = e1 + e2; /* Unbiased exponent */ /* Add in the implicit one to the manissae */ m1 += 1 << mSize; m2 += 1 << mSize; /* From lsb to msb, we add in m1 if m2 has the appropriate bit set */ for (mMask = 1; mMask >> mSize <= 1; mMask = mMask << 1) { if (mMask & m2) mant += m1; mant = mant >> 1; } /* If our mantissa is greater than 2, we must normalise */ if (mant & (1 << (eSize + 1))) { mant = mant >> 1; exp += 1; } mant -= 1 << mSize; }