File: operators.ispc

package info (click to toggle)
ispc 1.28.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 97,620 kB
  • sloc: cpp: 77,067; python: 8,303; yacc: 3,337; lex: 1,126; ansic: 631; sh: 475; makefile: 17
file content (68 lines) | stat: -rw-r--r-- 1,328 bytes parent folder | download | duplicates (2)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "test_static.isph"
struct S {
    float a;
};

// References "struct&" were put in random order to test them.
struct S operator*(struct S& rr, struct S rv) {
    struct S c;
    c.a = rr.a + rv.a + 2;
    return c;
}

struct S operator/(struct S& rr, struct S& rv) {
    struct S c;
    c.a = rr.a - rr.a + 2;
    return c;
}

struct S operator%(struct S rr, struct S& rv) {
    struct S c;
    c.a = rr.a + rv.a + 2;
    return c;
}

struct S operator+(struct S rr, struct S rv) {
    struct S c;
    c.a = rr.a / rv.a + 3;
    return c;
}

struct S operator-(struct S rr, struct S& rv) {
    struct S c;
    c.a = rr.a + rv.a + 2;
    return c;
}

struct S operator>>(struct S& rr, struct S rv) {
    struct S c;
    c.a = rr.a / rv.a + 3;
    return c;
}

struct S operator<<(struct S& rr, struct S& rv) {
    struct S c;
    c.a = rr.a + rv.a + 2;
    return c;
}

struct S a, a1;
struct S b, b1;
struct S d1, d2, d3, d4, d5, d6, d7;

task void f_f(uniform float RET[], uniform float aFOO[]) {
    a.a = aFOO[programIndex];
    b.a = -aFOO[programIndex];
    d1 = a * b;
    d2 = a / b;
    d3 = a % b;
    d4 = a + b;
    d5 = a - b;
    d6 = a >> b;
    d7 = a << b;
    RET[programIndex] = d1.a + d2.a + d3.a + d4.a + d5.a + d6.a + d7.a;
}

task void result(uniform float RET[4]) {
    RET[programIndex] = 14;
}