aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/compilable/test15898.d
blob: 01c325e9982bcf5a6d4ba21b515b24a7627f017a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// REQUIRED_ARGS: -O
// https://issues.dlang.org/show_bug.cgi?id=15898

int addAssignSimple(int[] , const(int)[] )
{
    uint c;
    return c;
}

void mulKaratsuba(int[] result, const(int)[] x, const(int)[] y, int[] )
{
    const(int)[] y1 = y;
    int[] newscratchbuff;
    int[] resultHigh = result;

    bool ysmaller2 = x.length >= y1.length;
    newscratchbuff[0..y1.length] = resultHigh;
    mulKaratsuba(
        resultHigh[1..$],
        ysmaller2 ? x[1..$] : y1,
        ysmaller2 ? y1 : x,
        newscratchbuff[y1.length..$]
    );

    addAssignSimple(resultHigh[1..$], newscratchbuff[0..y1.length]);
}