-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathreduce.go
More file actions
99 lines (97 loc) · 1.49 KB
/
reduce.go
File metadata and controls
99 lines (97 loc) · 1.49 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package main
import (
. "github.com/ktye/wg/module"
)
func rd0(yp int32, t T, n int32) K { return 0 }
func min(yp int32, t T, e int32) K { // &/x
var xp int32
switch t - 18 {
case 0: // Ct
xp = 127
for yp < e {
xp = mini(xp, I8(yp))
yp++
}
return Kc(xp)
case 1: // It
return Ki(minis(2147483647, yp, e))
case 2: // St
return Ks(minis((nn(K(I64(8)))<<3)-8, yp, e))
case 3: // Ft
return Kf(minfs(yp, e))
default:
return 0
}
}
func max(yp int32, t T, e int32) K { // |/x
var xp int32
switch t - 18 {
case 0: // Ct
xp = -128
for yp < e {
xp = maxi(xp, I8(yp))
yp++
}
return Kc(xp)
case 1: // It
return Ki(maxis(-2147483648, yp, e))
case 2: // St
return Ks(maxis(0, yp, e))
case 3: // Ft
return Kf(maxfs(yp, e))
default:
return 0
}
}
func sum(yp int32, t T, e int32) K { // +/x
xp := int32(0)
switch t - 18 {
case 0: // Ct
for yp < e {
xp += I8(yp)
yp++
}
return Kc(xp)
case 1: // It
return Ki(xp + sumi(yp, e))
case 2: // St
return 0
case 3: // Ft
f := 0.0
return Kf(f + sumf(yp, e))
case 4: // Zt
r := Kz(0, 0)
sumz(yp, e, int32(r))
return r
default:
return 0
}
}
func prd(yp int32, t T, e int32) K { // */x
xp := int32(1)
switch t - 18 {
case 0: // Ct
for yp < e {
xp *= I8(yp)
yp++
}
return Kc(xp)
case 1: // It
for yp < e {
xp *= I32(yp)
yp += 4
}
return Ki(xp)
case 2: // St
return 0
case 3: // Ft
f := 1.0
for yp < e {
f *= F64(yp)
yp += 8
}
return Kf(f)
default:
return 0
}
}