#include "game_types.h"

/* Float_Log2_80 @ 0x0801E400 (real 64B) -- log2 path via ParseIEEE + FromInt2. Mirrors src/matched/Float_Log2_80.c. */
/* Parses the pair, folds the exponent lanes (w3<<2 | w2>>30, OR 1 when the
   mantissa lane is nonzero), and dispatches FromInt2 over the frame. */
extern void Float_ParseIEEE(int *in, int *tmp);
extern int Float_FromInt2(int a, int b, int c, int d);

int Float_Log2_80(int a, int b)
{
    int in[2];
    int tmp[5];
    int e;
    in[0] = a;
    in[1] = b;
    Float_ParseIEEE(in, tmp);
    e = (tmp[4] << 2) | ((unsigned)tmp[3] >> 30);
    if ((tmp[3] & 0x3FFFFFFF) != 0)
        e |= 1;
    return Float_FromInt2(tmp[0], tmp[1], tmp[2], e);
}
