diff --git a/clone.go b/clone.go index 2bad3d6..55fc7d3 100644 --- a/clone.go +++ b/clone.go @@ -8,19 +8,19 @@ func (self ISize) Clone() ISize { return self } -func (self ISize8) Clone() ISize8 { +func (self I8) Clone() I8 { return self } -func (self ISize16) Clone() ISize16 { +func (self I16) Clone() I16 { return self } -func (self ISize32) Clone() ISize32 { +func (self I32) Clone() I32 { return self } -func (self ISize64) Clone() ISize64 { +func (self I64) Clone() I64 { return self } @@ -28,27 +28,27 @@ func (self USize) Clone() USize { return self } -func (self USize8) Clone() USize8 { +func (self U8) Clone() U8 { return self } -func (self USize16) Clone() USize16 { +func (self U16) Clone() U16 { return self } -func (self USize32) Clone() USize32 { +func (self U32) Clone() U32 { return self } -func (self USize64) Clone() USize64 { +func (self U64) Clone() U64 { return self } -func (self Float32) Clone() Float32 { +func (self F32) Clone() F32 { return self } -func (self Float64) Clone() Float64 { +func (self F64) Clone() F64 { return self } @@ -56,7 +56,7 @@ func (self Byte) Clone() Byte { return self } -func (self Rune) Clone() Rune { +func (self Char) Clone() Char { return self } diff --git a/cmp.go b/cmp.go index 3512e53..22fb401 100644 --- a/cmp.go +++ b/cmp.go @@ -23,7 +23,7 @@ func (self ISize) Cmp(rhs ISize) Ordering { } } -func (self ISize8) Cmp(rhs ISize8) Ordering { +func (self I8) Cmp(rhs I8) Ordering { if self < rhs { return OrderingLess } else if self > rhs { @@ -33,7 +33,7 @@ func (self ISize8) Cmp(rhs ISize8) Ordering { } } -func (self ISize16) Cmp(rhs ISize16) Ordering { +func (self I16) Cmp(rhs I16) Ordering { if self < rhs { return OrderingLess } else if self > rhs { @@ -43,7 +43,7 @@ func (self ISize16) Cmp(rhs ISize16) Ordering { } } -func (self ISize32) Cmp(rhs ISize32) Ordering { +func (self I32) Cmp(rhs I32) Ordering { if self < rhs { return OrderingLess } else if self > rhs { @@ -53,7 +53,7 @@ func (self ISize32) Cmp(rhs ISize32) Ordering { } } -func (self ISize64) Cmp(rhs ISize64) Ordering { +func (self I64) Cmp(rhs I64) Ordering { if self < rhs { return OrderingLess } else if self > rhs { @@ -73,7 +73,7 @@ func (self USize) Cmp(rhs USize) Ordering { } } -func (self USize8) Cmp(rhs USize8) Ordering { +func (self U8) Cmp(rhs U8) Ordering { if self < rhs { return OrderingLess } else if self > rhs { @@ -83,7 +83,7 @@ func (self USize8) Cmp(rhs USize8) Ordering { } } -func (self USize16) Cmp(rhs USize16) Ordering { +func (self U16) Cmp(rhs U16) Ordering { if self < rhs { return OrderingLess } else if self > rhs { @@ -93,7 +93,7 @@ func (self USize16) Cmp(rhs USize16) Ordering { } } -func (self USize32) Cmp(rhs USize32) Ordering { +func (self U32) Cmp(rhs U32) Ordering { if self < rhs { return OrderingLess } else if self > rhs { @@ -103,7 +103,7 @@ func (self USize32) Cmp(rhs USize32) Ordering { } } -func (self USize64) Cmp(rhs USize64) Ordering { +func (self U64) Cmp(rhs U64) Ordering { if self < rhs { return OrderingLess } else if self > rhs { @@ -113,7 +113,7 @@ func (self USize64) Cmp(rhs USize64) Ordering { } } -func (self Float32) Cmp(rhs Float32) Ordering { +func (self F32) Cmp(rhs F32) Ordering { if self < rhs { return OrderingLess } else if self > rhs { @@ -123,7 +123,7 @@ func (self Float32) Cmp(rhs Float32) Ordering { } } -func (self Float64) Cmp(rhs Float64) Ordering { +func (self F64) Cmp(rhs F64) Ordering { if self < rhs { return OrderingLess } else if self > rhs { @@ -163,7 +163,7 @@ func (self Byte) Cmp(rhs Byte) Ordering { } } -func (self Rune) Cmp(rhs Rune) Ordering { +func (self Char) Cmp(rhs Char) Ordering { if self == rhs { return OrderingEqual } else if self > rhs { @@ -191,19 +191,19 @@ func (self ISize) Eq(rhs ISize) Bool { return self == rhs } -func (self ISize8) Eq(rhs ISize8) Bool { +func (self I8) Eq(rhs I8) Bool { return self == rhs } -func (self ISize16) Eq(rhs ISize16) Bool { +func (self I16) Eq(rhs I16) Bool { return self == rhs } -func (self ISize32) Eq(rhs ISize32) Bool { +func (self I32) Eq(rhs I32) Bool { return self == rhs } -func (self ISize64) Eq(rhs ISize64) Bool { +func (self I64) Eq(rhs I64) Bool { return self == rhs } @@ -211,27 +211,27 @@ func (self USize) Eq(rhs USize) Bool { return self == rhs } -func (self USize8) Eq(rhs USize8) Bool { +func (self U8) Eq(rhs U8) Bool { return self == rhs } -func (self USize16) Eq(rhs USize16) Bool { +func (self U16) Eq(rhs U16) Bool { return self == rhs } -func (self USize32) Eq(rhs USize32) Bool { +func (self U32) Eq(rhs U32) Bool { return self == rhs } -func (self USize64) Eq(rhs USize64) Bool { +func (self U64) Eq(rhs U64) Bool { return self == rhs } -func (self Float32) Eq(rhs Float32) Bool { +func (self F32) Eq(rhs F32) Bool { return self == rhs } -func (self Float64) Eq(rhs Float64) Bool { +func (self F64) Eq(rhs F64) Bool { return self == rhs } @@ -247,7 +247,7 @@ func (self Byte) Eq(rhs Byte) Bool { return self == rhs } -func (self Rune) Eq(rhs Rune) Bool { +func (self Char) Eq(rhs Char) Bool { return self == rhs } diff --git a/fmt.go b/fmt.go index ebc80e0..27483a9 100644 --- a/fmt.go +++ b/fmt.go @@ -13,19 +13,19 @@ func (self ISize) Display() String { return self.ToString() } -func (self ISize8) Display() String { +func (self I8) Display() String { return self.ToString() } -func (self ISize16) Display() String { +func (self I16) Display() String { return self.ToString() } -func (self ISize32) Display() String { +func (self I32) Display() String { return self.ToString() } -func (self ISize64) Display() String { +func (self I64) Display() String { return self.ToString() } @@ -33,27 +33,27 @@ func (self USize) Display() String { return self.ToString() } -func (self USize8) Display() String { +func (self U8) Display() String { return self.ToString() } -func (self USize16) Display() String { +func (self U16) Display() String { return self.ToString() } -func (self USize32) Display() String { +func (self U32) Display() String { return self.ToString() } -func (self USize64) Display() String { +func (self U64) Display() String { return self.ToString() } -func (self Float32) Display() String { +func (self F32) Display() String { return self.ToString() } -func (self Float64) Display() String { +func (self F64) Display() String { return self.ToString() } @@ -61,7 +61,7 @@ func (self Byte) Display() String { return self.ToString() } -func (self Rune) Display() String { +func (self Char) Display() String { return self.ToString() } @@ -99,56 +99,56 @@ func (self ISize) Debug() String { return String(fmt.Sprintf("ISize(%s)", self.ToString())) } -func (self ISize8) Debug() String { - return String(fmt.Sprintf("ISize8(%s)", self.ToString())) +func (self I8) Debug() String { + return String(fmt.Sprintf("I8(%s)", self.ToString())) } -func (self ISize16) Debug() String { - return String(fmt.Sprintf("ISize16(%s)", self.ToString())) +func (self I16) Debug() String { + return String(fmt.Sprintf("I16(%s)", self.ToString())) } -func (self ISize32) Debug() String { - return String(fmt.Sprintf("ISize32(%s)", self.ToString())) +func (self I32) Debug() String { + return String(fmt.Sprintf("I32(%s)", self.ToString())) } -func (self ISize64) Debug() String { - return String(fmt.Sprintf("ISize64(%s)", self.ToString())) +func (self I64) Debug() String { + return String(fmt.Sprintf("I64(%s)", self.ToString())) } func (self USize) Debug() String { return String(fmt.Sprintf("USize(%s)", self.ToString())) } -func (self USize8) Debug() String { - return String(fmt.Sprintf("USize8(%s)", self.ToString())) +func (self U8) Debug() String { + return String(fmt.Sprintf("U8(%s)", self.ToString())) } -func (self USize16) Debug() String { - return String(fmt.Sprintf("USize16(%s)", self.ToString())) +func (self U16) Debug() String { + return String(fmt.Sprintf("U16(%s)", self.ToString())) } -func (self USize32) Debug() String { - return String(fmt.Sprintf("USize32(%s)", self.ToString())) +func (self U32) Debug() String { + return String(fmt.Sprintf("U32(%s)", self.ToString())) } -func (self USize64) Debug() String { - return String(fmt.Sprintf("USize64(%s)", self.ToString())) +func (self U64) Debug() String { + return String(fmt.Sprintf("U64(%s)", self.ToString())) } -func (self Float32) Debug() String { - return String(fmt.Sprintf("Float32(%s)", self.ToString())) +func (self F32) Debug() String { + return String(fmt.Sprintf("F32(%s)", self.ToString())) } -func (self Float64) Debug() String { - return String(fmt.Sprintf("Float64(%s)", self.ToString())) +func (self F64) Debug() String { + return String(fmt.Sprintf("F64(%s)", self.ToString())) } func (self Byte) Debug() String { return String(fmt.Sprintf("Byte(%s)", self.ToString())) } -func (self Rune) Debug() String { - return String(fmt.Sprintf("Rune(%s)", self.ToString())) +func (self Char) Debug() String { + return String(fmt.Sprintf("Char(%s)", self.ToString())) } func (self String) Debug() String { diff --git a/ops.go b/ops.go index 4d41394..d61ed8a 100644 --- a/ops.go +++ b/ops.go @@ -39,3 +39,531 @@ type MulAssign[T any] interface { type DivAssign[T any] interface { DivAssign(rhs T) } + +// Add implements +func (self ISize) Add(rhs ISize) ISize { + return self + rhs +} + +func (self I8) Add(rhs I8) I8 { + return self + rhs +} + +func (self I16) Add(rhs I16) I16 { + return self + rhs +} + +func (self I32) Add(rhs I32) I32 { + return self + rhs +} + +func (self I64) Add(rhs I64) I64 { + return self + rhs +} + +func (self USize) Add(rhs USize) USize { + return self + rhs +} + +func (self U8) Add(rhs U8) U8 { + return self + rhs +} + +func (self U16) Add(rhs U16) U16 { + return self + rhs +} + +func (self U32) Add(rhs U32) U32 { + return self + rhs +} + +func (self U64) Add(rhs U64) U64 { + return self + rhs +} + +func (self F32) Add(rhs F32) F32 { + return self + rhs +} + +func (self F64) Add(rhs F64) F64 { + return self + rhs +} + +func (self Byte) Add(rhs Byte) Byte { + return self + rhs +} + +func (self Char) Add(rhs Char) Char { + return self + rhs +} + +func (self String) Add(rhs String) String { + return self + rhs +} + +func (self Complex64) Add(rhs Complex64) Complex64 { + return self + rhs +} + +func (self Complex128) Add(rhs Complex128) Complex128 { + return self + rhs +} + +// Sub implements +func (self ISize) Sub(rhs ISize) ISize { + return self - rhs +} + +func (self I8) Sub(rhs I8) I8 { + return self - rhs +} + +func (self I16) Sub(rhs I16) I16 { + return self - rhs +} + +func (self I32) Sub(rhs I32) I32 { + return self - rhs +} + +func (self I64) Sub(rhs I64) I64 { + return self - rhs +} + +func (self USize) Sub(rhs USize) USize { + return self - rhs +} + +func (self U8) Sub(rhs U8) U8 { + return self - rhs +} + +func (self U16) Sub(rhs U16) U16 { + return self - rhs +} + +func (self U32) Sub(rhs U32) U32 { + return self - rhs +} + +func (self U64) Sub(rhs U64) U64 { + return self - rhs +} + +func (self F32) Sub(rhs F32) F32 { + return self - rhs +} + +func (self F64) Sub(rhs F64) F64 { + return self - rhs +} + +func (self Byte) Sub(rhs Byte) Byte { + return self - rhs +} + +func (self Char) Sub(rhs Char) Char { + return self - rhs +} + +func (self Complex64) Sub(rhs Complex64) Complex64 { + return self - rhs +} + +func (self Complex128) Sub(rhs Complex128) Complex128 { + return self - rhs +} + +// Mul implements +func (self ISize) Mul(rhs ISize) ISize { + return self * rhs +} + +func (self I8) Mul(rhs I8) I8 { + return self * rhs +} + +func (self I16) Mul(rhs I16) I16 { + return self * rhs +} + +func (self I32) Mul(rhs I32) I32 { + return self * rhs +} + +func (self I64) Mul(rhs I64) I64 { + return self * rhs +} + +func (self USize) Mul(rhs USize) USize { + return self * rhs +} + +func (self U8) Mul(rhs U8) U8 { + return self * rhs +} + +func (self U16) Mul(rhs U16) U16 { + return self * rhs +} + +func (self U32) Mul(rhs U32) U32 { + return self * rhs +} + +func (self U64) Mul(rhs U64) U64 { + return self * rhs +} + +func (self F32) Mul(rhs F32) F32 { + return self * rhs +} + +func (self F64) Mul(rhs F64) F64 { + return self * rhs +} + +func (self Byte) Mul(rhs Byte) Byte { + return self * rhs +} + +func (self Char) Mul(rhs Char) Char { + return self * rhs +} + +func (self Complex64) Mul(rhs Complex64) Complex64 { + return self * rhs +} + +func (self Complex128) Mul(rhs Complex128) Complex128 { + return self * rhs +} + +// Div implements +func (self ISize) Div(rhs ISize) ISize { + return self / rhs +} + +func (self I8) Div(rhs I8) I8 { + return self / rhs +} + +func (self I16) Div(rhs I16) I16 { + return self / rhs +} + +func (self I32) Div(rhs I32) I32 { + return self / rhs +} + +func (self I64) Div(rhs I64) I64 { + return self / rhs +} + +func (self USize) Div(rhs USize) USize { + return self / rhs +} + +func (self U8) Div(rhs U8) U8 { + return self / rhs +} + +func (self U16) Div(rhs U16) U16 { + return self / rhs +} + +func (self U32) Div(rhs U32) U32 { + return self / rhs +} + +func (self U64) Div(rhs U64) U64 { + return self / rhs +} + +func (self F32) Div(rhs F32) F32 { + return self / rhs +} + +func (self F64) Div(rhs F64) F64 { + return self / rhs +} + +func (self Byte) Div(rhs Byte) Byte { + return self / rhs +} + +func (self Char) Div(rhs Char) Char { + return self / rhs +} + +func (self Complex64) Div(rhs Complex64) Complex64 { + return self / rhs +} + +func (self Complex128) Div(rhs Complex128) Complex128 { + return self / rhs +} + +// AddAssign implements +func (self *ISize) AddAssign(rhs ISize) { + *self += rhs +} + +func (self *I8) AddAssign(rhs I8) { + *self += rhs +} + +func (self *I16) AddAssign(rhs I16) { + *self += rhs +} + +func (self *I32) AddAssign(rhs I32) { + *self += rhs +} + +func (self *I64) AddAssign(rhs I64) { + *self += rhs +} + +func (self *USize) AddAssign(rhs USize) { + *self += rhs +} + +func (self *U8) AddAssign(rhs U8) { + *self += rhs +} + +func (self *U16) AddAssign(rhs U16) { + *self += rhs +} + +func (self *U32) AddAssign(rhs U32) { + *self += rhs +} + +func (self *U64) AddAssign(rhs U64) { + *self += rhs +} + +func (self *F32) AddAssign(rhs F32) { + *self += rhs +} + +func (self *F64) AddAssign(rhs F64) { + *self += rhs +} + +func (self *Byte) AddAssign(rhs Byte) { + *self += rhs +} + +func (self *Char) AddAssign(rhs Char) { + *self += rhs +} + +func (self *String) AddAssign(rhs String) { + *self += rhs +} + +func (self *Complex64) AddAssign(rhs Complex64) { + *self += rhs +} + +func (self *Complex128) AddAssign(rhs Complex128) { + *self += rhs +} + +// SubAssign implements +func (self *ISize) SubAssign(rhs ISize) { + *self -= rhs +} + +func (self *I8) SubAssign(rhs I8) { + *self -= rhs +} + +func (self *I16) SubAssign(rhs I16) { + *self -= rhs +} + +func (self *I32) SubAssign(rhs I32) { + *self -= rhs +} + +func (self *I64) SubAssign(rhs I64) { + *self -= rhs +} + +func (self *USize) SubAssign(rhs USize) { + *self -= rhs +} + +func (self *U8) SubAssign(rhs U8) { + *self -= rhs +} + +func (self *U16) SubAssign(rhs U16) { + *self -= rhs +} + +func (self *U32) SubAssign(rhs U32) { + *self -= rhs +} + +func (self *U64) SubAssign(rhs U64) { + *self -= rhs +} + +func (self *F32) SubAssign(rhs F32) { + *self -= rhs +} + +func (self *F64) SubAssign(rhs F64) { + *self -= rhs +} + +func (self *Byte) SubAssign(rhs Byte) { + *self -= rhs +} + +func (self *Char) SubAssign(rhs Char) { + *self -= rhs +} + +func (self *Complex64) SubAssign(rhs Complex64) { + *self -= rhs +} + +func (self *Complex128) SubAssign(rhs Complex128) { + *self -= rhs +} + +// MulAssign implements +func (self *ISize) MulAssign(rhs ISize) { + *self *= rhs +} + +func (self *I8) MulAssign(rhs I8) { + *self *= rhs +} + +func (self *I16) MulAssign(rhs I16) { + *self *= rhs +} + +func (self *I32) MulAssign(rhs I32) { + *self *= rhs +} + +func (self *I64) MulAssign(rhs I64) { + *self *= rhs +} + +func (self *USize) MulAssign(rhs USize) { + *self *= rhs +} + +func (self *U8) MulAssign(rhs U8) { + *self *= rhs +} + +func (self *U16) MulAssign(rhs U16) { + *self *= rhs +} + +func (self *U32) MulAssign(rhs U32) { + *self *= rhs +} + +func (self *U64) MulAssign(rhs U64) { + *self *= rhs +} + +func (self *F32) MulAssign(rhs F32) { + *self *= rhs +} + +func (self *F64) MulAssign(rhs F64) { + *self *= rhs +} + +func (self *Byte) MulAssign(rhs Byte) { + *self *= rhs +} + +func (self *Char) MulAssign(rhs Char) { + *self *= rhs +} + +func (self *Complex64) MulAssign(rhs Complex64) { + *self *= rhs +} + +func (self *Complex128) MulAssign(rhs Complex128) { + *self *= rhs +} + +// DivAssign implements +func (self *ISize) DivAssign(rhs ISize) { + *self /= rhs +} + +func (self *I8) DivAssign(rhs I8) { + *self /= rhs +} + +func (self *I16) DivAssign(rhs I16) { + *self /= rhs +} + +func (self *I32) DivAssign(rhs I32) { + *self /= rhs +} + +func (self *I64) DivAssign(rhs I64) { + *self /= rhs +} + +func (self *USize) DivAssign(rhs USize) { + *self /= rhs +} + +func (self *U8) DivAssign(rhs U8) { + *self /= rhs +} + +func (self *U16) DivAssign(rhs U16) { + *self /= rhs +} + +func (self *U32) DivAssign(rhs U32) { + *self /= rhs +} + +func (self *U64) DivAssign(rhs U64) { + *self /= rhs +} + +func (self *F32) DivAssign(rhs F32) { + *self /= rhs +} + +func (self *F64) DivAssign(rhs F64) { + *self /= rhs +} + +func (self *Byte) DivAssign(rhs Byte) { + *self /= rhs +} + +func (self *Char) DivAssign(rhs Char) { + *self /= rhs +} + +func (self *Complex64) DivAssign(rhs Complex64) { + *self /= rhs +} + +func (self *Complex128) DivAssign(rhs Complex128) { + *self /= rhs +} diff --git a/primitive.go b/primitive.go index 988dae1..0ae356c 100644 --- a/primitive.go +++ b/primitive.go @@ -1,23 +1,23 @@ package gost type ISize int -type ISize8 int8 -type ISize16 int16 -type ISize32 int32 -type ISize64 int64 +type I8 int8 +type I16 int16 +type I32 int32 +type I64 int64 type USize uint -type USize8 uint8 -type USize16 uint16 -type USize32 uint32 -type USize64 uint64 +type U8 uint8 +type U16 uint16 +type U32 uint32 +type U64 uint64 -type Float32 float32 -type Float64 float64 +type F32 float32 +type F64 float64 type Byte byte -type Rune rune +type Char rune type String string diff --git a/string.go b/string.go index 0ec6b14..d66cc1a 100644 --- a/string.go +++ b/string.go @@ -13,19 +13,19 @@ func (self ISize) ToString() String { return String(strconv.Itoa(int(self))) } -func (self ISize8) ToString() String { +func (self I8) ToString() String { return String(strconv.Itoa(int(self))) } -func (self ISize16) ToString() String { +func (self I16) ToString() String { return String(strconv.Itoa(int(self))) } -func (self ISize32) ToString() String { +func (self I32) ToString() String { return String(strconv.Itoa(int(self))) } -func (self ISize64) ToString() String { +func (self I64) ToString() String { return String(strconv.Itoa(int(self))) } @@ -33,27 +33,27 @@ func (self USize) ToString() String { return String(strconv.Itoa(int(self))) } -func (self USize8) ToString() String { +func (self U8) ToString() String { return String(strconv.Itoa(int(self))) } -func (self USize16) ToString() String { +func (self U16) ToString() String { return String(strconv.Itoa(int(self))) } -func (self USize32) ToString() String { +func (self U32) ToString() String { return String(strconv.Itoa(int(self))) } -func (self USize64) ToString() String { +func (self U64) ToString() String { return String(strconv.Itoa(int(self))) } -func (self Float32) ToString() String { +func (self F32) ToString() String { return String(strconv.FormatFloat(float64(self), 'f', -1, 32)) } -func (self Float64) ToString() String { +func (self F64) ToString() String { return String(strconv.FormatFloat(float64(self), 'f', -1, 64)) } @@ -61,7 +61,7 @@ func (self Byte) ToString() String { return String(strconv.Itoa(int(self))) } -func (self Rune) ToString() String { +func (self Char) ToString() String { return String(strconv.Itoa(int(self))) }