-
Notifications
You must be signed in to change notification settings - Fork 0
/
primitive.go
79 lines (63 loc) · 904 Bytes
/
primitive.go
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
package gost
type Unit struct{}
type Void struct{}
type ISize int
type I8 int8
type I16 int16
type I32 int32
type I64 int64
type I128 struct {
high I64
low U64
}
type USize uint
type U8 uint8
type U16 uint16
type U32 uint32
type U64 uint64
type U128 struct {
high U64
low U64
}
type F32 float32
type F64 float64
type Byte byte
type Char rune
type String string
type Bool bool
type Complex64 complex64
type Complex128 complex128
type Error error
type Any interface{}
func U128_FromU64(low U64) U128 {
return U128{
high: 0,
low: low,
}
}
func I128_FromI64(low I64) I128 {
isNegative := low < 0
if low == 0 {
return I128{
high: 0,
low: 0,
}
}
if isNegative {
return I128{
high: 0,
low: U64(low.Abs()),
}.Neg()
} else {
return I128{
high: 0,
low: U64(low),
}
}
}
func I128_FromU64(low U64) I128 {
return I128{
high: 0,
low: low,
}
}