Displaying 2 results from an estimated 2 matches for "floordiv".
Did you mean:
floord
2018 Mar 30
2
Floor-integer-div and integer sign operations?
I'm looking for ways to do some basic operations without using branches.
The key operation I want is a floored/round-to-negative-infinity integer
division (as opposed to the default round-to-zero).
7 floordiv 5 = 1
-3 floordiv 5 = -1
-6 floordiv 5 = -2
As I guess that doesn't exist, the operation can be constructed as:
(a/b) + (a>>31)
Assuming a is 32 bits. I can probably check the bit count, but perhaps
there's an op that does this already.
I'm also looking for a `sign...
2018 Mar 30
0
Floor-integer-div and integer sign operations?
...03/30/2018 03:58 AM, edA-qa mort-ora-y via llvm-dev wrote:
> I'm looking for ways to do some basic operations without using branches.
>
> The key operation I want is a floored/round-to-negative-infinity integer
> division (as opposed to the default round-to-zero).
>
> 7 floordiv 5 = 1
> -3 floordiv 5 = -1
> -6 floordiv 5 = -2
>
> As I guess that doesn't exist, the operation can be constructed as:
>
> (a/b) + (a>>31)
>
> Assuming a is 32 bits. I can probably check the bit count, but perhaps
> there's an op that does...