On Tuesday, 19 September 2023 at 03:44:18 UTC, Vitaliy Fadeev
wrote:
What D function or D operator does this?
```asm
IDIV EAX, r/m32
```
```
IDIV 5, 2
EAX = 2
EDX = 1
```
and returns (2,1) at once?
If you use LDC it'll automatically optimize that for you
https://d.godbolt.org/z/oz4h9ccbP
On Tuesday, 19 September 2023 at 03:53:06 UTC, Richard (Rikki)
Andrew Cattermole wrote:
There are no operators for this, not that you need one.
```d
void func(int numerator, int denominator, out int quotient, out
int remainder) {
quotient = numerator / denominator;
remainder =
There are no operators for this, not that you need one.
```d
void func(int numerator, int denominator, out int quotient, out int
remainder) {
quotient = numerator / denominator;
remainder = numerator % denominator;
}
```
This will produce with ldc2 -O3:
```
void example.func(int,
On Tuesday, 19 September 2023 at 03:44:18 UTC, Vitaliy Fadeev
wrote:
What D function or D operator does this?
```asm
IDIV EAX, r/m32
```
```
IDIV 5, 2
EAX = 2
EDX = 1
```
and returns (2,1) at once?
You can either use function `out` parameters with return value or
`tuples`:
```D
import
What D function or D operator does this?
```asm
IDIV EAX, r/m32
```
```
IDIV 5, 2
EAX = 2
EDX = 1
```
and returns (2,1) at once?