idiv.c File Reference

#include <stdint.h>
#include <errno.h>
#include "emu/emu.h"
#include "emu/emu_cpu.h"
#include "emu/emu_cpu_data.h"
#include "emu/emu_cpu_stack.h"
#include "emu/emu_memory.h"
Include dependency graph for idiv.c:

Defines

#define INSTR_CALC(dbits, bits, cpu, dividend, divisor, quotient, remainder)

Functions

int32_t instr_group_3_f6_idiv (struct emu_cpu *c, struct emu_cpu_instruction *i)
int32_t instr_group_3_f7_idiv (struct emu_cpu *c, struct emu_cpu_instruction *i)

Define Documentation

#define INSTR_CALC ( dbits,
bits,
cpu,
dividend,
divisor,
quotient,
remainder   ) 
Value:
{\
        if (divisor == 0) \
        { \
                emu_strerror_set(cpu->emu,"div by zero (%i bits)\n",bits); \
                emu_errno_set(cpu->emu,EINVAL); \
                return -1; \
        } \
        INTOF(dbits) q_result = (INTOF(dbits))dividend / (INTOF(bits))divisor; \
        INTOF(dbits) r_result = (INTOF(dbits))dividend % (INTOF(bits))divisor; \
\
        quotient = q_result; \
        remainder = r_result; \
        if ( q_result < max_inttype_borders[bits/8][0][0] || \
                 q_result > max_inttype_borders[bits/8][0][1] ) \
        { \
                emu_strerror_set(cpu->emu,"div quotient larger than intborder (%i bits)\n",bits); \
                emu_errno_set(cpu->emu,EINVAL); \
                return -1; \
        } \
}

Function Documentation

int32_t instr_group_3_f6_idiv ( struct emu_cpu c,
struct emu_cpu_instruction i 
)
int32_t instr_group_3_f7_idiv ( struct emu_cpu c,
struct emu_cpu_instruction i 
)

Generated on Sun Jan 9 16:50:12 2011 for libemu by  doxygen 1.6.1