Exemple #1
0
void
yasm_floatnum_print(const yasm_floatnum *flt, FILE *f)
{
    unsigned char out[10];
    unsigned char *str;
    int i;

    /* Internal format */
    str = BitVector_to_Hex(flt->mantissa);
    fprintf(f, "%c %s *2^%04x\n", flt->sign?'-':'+', (char *)str,
            flt->exponent);
    yasm_xfree(str);

    /* 32-bit (single precision) format */
    fprintf(f, "32-bit: %d: ",
            yasm_floatnum_get_sized(flt, out, 4, 32, 0, 0, 0));
    for (i=0; i<4; i++)
        fprintf(f, "%02x ", out[i]);
    fprintf(f, "\n");

    /* 64-bit (double precision) format */
    fprintf(f, "64-bit: %d: ",
            yasm_floatnum_get_sized(flt, out, 8, 64, 0, 0, 0));
    for (i=0; i<8; i++)
        fprintf(f, "%02x ", out[i]);
    fprintf(f, "\n");

    /* 80-bit (extended precision) format */
    fprintf(f, "80-bit: %d: ",
            yasm_floatnum_get_sized(flt, out, 10, 80, 0, 0, 0));
    for (i=0; i<10; i++)
        fprintf(f, "%02x ", out[i]);
    fprintf(f, "\n");
}
Exemple #2
0
void
yasm_intnum_print(const yasm_intnum *intn, FILE *f)
{
    unsigned char *s;

    switch (intn->type) {
        case INTNUM_L:
            fprintf(f, "0x%lx", intn->val.l);
            break;
        case INTNUM_BV:
            s = BitVector_to_Hex(intn->val.bv);
            fprintf(f, "0x%s", (char *)s);
            yasm_xfree(s);
            break;
    }
}