Subject: Re: Castings...
To: Neil A. Carson <neil@causality.com>
From: Chris G. Demetriou <cgd@Pa.dec.com>
List: tech-kern
Date: 10/08/1997 18:02:05
> 'BSD retains this functionality for ints, but for quads the one hilited
> above different (gives -2). Does this mean that the NetBSD moddi3
> function should not return negative numbers?
I don't know what moddi3 does.
However, it seems quite logical that:
FOO x, y, d, r;
x = M;
y = N;
d = x / y;
r = x % y;
should yield the same results for "#define FOO int" as for "#define FOO
long long", assuming M and N are in range, etc. (That, of course, is
modulo any wacked out C promotions happening, but I don't think those
would be a problem in the example you've described.)
The fact that you're getting a different result for that case makes
_me_ think that that the code giving you that result is buggy.
chris