/* Divide a by b, and return rounded integer.  */
CLR_INT32 RoundDiv(CLR_INT32 a, CLR_INT32 b)
/* Divide a by b, and return rounded integer.  */
CLR_INT32 RoundDiv(CLR_INT32 a, CLR_INT32 b)
{
    if (b == 0)
        return 0xFFFF;
    CLR_INT32 d = a / b;
    CLR_INT32 r = abs(a) % abs(b);
    if ((r * 2) > abs(a))
    {
        d = (abs(d) + 1) * sign(b) * sign(a);
    }
    return d;
}